]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/libauth/auth_chuid.c
amd64: FP: always use enough to fit AVX state and align to 64 bytes
[plan9front.git] / sys / src / libauth / auth_chuid.c
index 1bfbfff92cce6c698d0f74377251d5b4f66f55e1..300e93f67316096173635f6ebaabbf2bd701ea33 100644 (file)
@@ -10,7 +10,7 @@ auth_chuid(AuthInfo *ai, char *ns)
 {
        int rv, fd;
 
-       if(ai == nil || ai->cap == nil){
+       if(ai == nil || ai->cap == nil || ai->cap[0] == 0){
                werrstr("no capability");
                return -1;
        }
@@ -30,8 +30,10 @@ auth_chuid(AuthInfo *ai, char *ns)
 
        /* get a link to factotum as new user */
        fd = open("/srv/factotum", ORDWR);
-       if(fd >= 0)
+       if(fd >= 0){
                mount(fd, -1, "/mnt", MREPL, "");
+               close(fd);
+       }
 
        /* set up new namespace */
        return newns(ai->cuid, ns);