diff 0e9c5f30eabbf213023658efb863dbaf6a608a51 uncommitted --- a/sys/src/libauth/auth_getkey.c +++ b/sys/src/libauth/auth_getkey.c @@ -25,6 +25,7 @@ werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params); return -1; } + free(d); switch(pid = fork()){ case -1: werrstr("can't fork for %s: %r", name);
> diff 0e9c5f30eabbf213023658efb863dbaf6a608a51 uncommitted
> --- a/sys/src/libauth/auth_getkey.c
> +++ b/sys/src/libauth/auth_getkey.c
> @@ -25,6 +25,7 @@
> werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
> return -1;
> }
> + free(d);
> switch(pid = fork()){
> case -1:
> werrstr("can't fork for %s: %r", name);
Good find, but we need to free the Dir in the “/factotum may be bad” case too. Just latch the type and free the Dir unconditionally before checking the type.
On Mon, Nov 14, 2022 at 10:45:48PM +0100, Alex Musolino wrote:
> > diff 0e9c5f30eabbf213023658efb863dbaf6a608a51 uncommitted
> > --- a/sys/src/libauth/auth_getkey.c
> > +++ b/sys/src/libauth/auth_getkey.c
> > @@ -25,6 +25,7 @@
> > werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
> > return -1;
> > }
> > + free(d);
> > switch(pid = fork()){
> > case -1:
> > werrstr("can't fork for %s: %r", name);
>
> Good find, but we need to free the Dir in the ???/factotum may be bad??? case too. Just latch the type and free the Dir unconditionally before checking the type.
if(0) if(d->type != '/'){
^^^^^
werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
return -1;
}
Should that part be removed?
> if(0) if(d->type != '/'){
> ^^^^^
> werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
> return -1;
> }
>
> Should that part be removed?
Oh, I didn’t even notice the if(0) way over there. Perhaps we can just remove the dead code?
On Tue, Nov 15, 2022 at 10:44:07AM +0100, Alex Musolino wrote:
> > if(0) if(d->type != '/'){
> > ^^^^^
> > werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
> > return -1;
> > }
> >
> > Should that part be removed?
>
> Oh, I didn???t even notice the if(0) way over there. Perhaps we can just remove the dead code?
Can we?
diff 30c5296f32b87d83529d772732726891e1261c9c ca030712ba270e6b74a10ff8bf914235283e7471 --- a/sys/src/libauth/auth_getkey.c +++ b/sys/src/libauth/auth_getkey.c @@ -21,10 +21,6 @@ werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params); return -1; } -if(0) if(d->type != '/'){ - werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params); - return -1; - } switch(pid = fork()){ case -1: werrstr("can't fork for %s: %r", name);
diff ca030712ba270e6b74a10ff8bf914235283e7471 1e6748e7df4f757b489f82c85e2a7d8a9558d0b8 --- a/sys/src/libauth/auth_getkey.c +++ b/sys/src/libauth/auth_getkey.c @@ -21,6 +21,7 @@ werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params); return -1; } + free(d); switch(pid = fork()){ case -1: werrstr("can't fork for %s: %r", name);
Ping. diff 30c5296f32b87d83529d772732726891e1261c9c ca030712ba270e6b74a10ff8bf914235283e7471 --- a/sys/src/libauth/auth_getkey.c +++ b/sys/src/libauth/auth_getkey.c @@ -21,10 +21,6 @@ werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params); return -1; } -if(0) if(d->type != '/'){ - werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params); - return -1; - } switch(pid = fork()){ case -1: werrstr("can't fork for %s: %r", name);
Ping. diff ca030712ba270e6b74a10ff8bf914235283e7471 1e6748e7df4f757b489f82c85e2a7d8a9558d0b8 --- a/sys/src/libauth/auth_getkey.c +++ b/sys/src/libauth/auth_getkey.c @@ -21,6 +21,7 @@ werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params); return -1; } + free(d); switch(pid = fork()){ case -1: werrstr("can't fork for %s: %r", name);
Ping. diff 30c5296f32b87d83529d772732726891e1261c9c ca030712ba270e6b74a10ff8bf914235283e7471 --- a/sys/src/libauth/auth_getkey.c +++ b/sys/src/libauth/auth_getkey.c @@ -21,10 +21,6 @@ werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params); return -1; } -if(0) if(d->type != '/'){ - werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params); - return -1; - } switch(pid = fork()){ case -1: werrstr("can't fork for %s: %r", name);
Ping. diff ca030712ba270e6b74a10ff8bf914235283e7471 1e6748e7df4f757b489f82c85e2a7d8a9558d0b8 --- a/sys/src/libauth/auth_getkey.c +++ b/sys/src/libauth/auth_getkey.c @@ -21,6 +21,7 @@ werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params); return -1; } + free(d); switch(pid = fork()){ case -1: werrstr("can't fork for %s: %r", name);
applied. thanks! -- cinap