]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/libauth/auth_chuid.c
libaml: fix gc bug, need to amltake()/amldrop() temporary buffer
[plan9front.git] / sys / src / libauth / auth_chuid.c
index 300e93f67316096173635f6ebaabbf2bd701ea33..4703ea0006e05e660192d2bd93515a1369c73e36 100644 (file)
@@ -16,7 +16,7 @@ auth_chuid(AuthInfo *ai, char *ns)
        }
 
        /* change uid */
-       fd = open("#¤/capuse", OWRITE);
+       fd = open("#¤/capuse", OWRITE|OCEXEC);
        if(fd < 0){
                werrstr("opening #¤/capuse: %r");
                return -1;
@@ -31,8 +31,8 @@ auth_chuid(AuthInfo *ai, char *ns)
        /* get a link to factotum as new user */
        fd = open("/srv/factotum", ORDWR);
        if(fd >= 0){
-               mount(fd, -1, "/mnt", MREPL, "");
-               close(fd);
+               if(mount(fd, -1, "/mnt", MREPL, "") == -1)
+                       close(fd);
        }
 
        /* set up new namespace */