callscgi: Fixed a couple of simple bugs.
authorFredrik Tolf <fredrik@dolda2000.com>
Fri, 3 Sep 2010 04:45:53 +0000 (06:45 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Fri, 3 Sep 2010 04:45:53 +0000 (06:45 +0200)
src/callscgi.c

index c5b5499..243f323 100644 (file)
@@ -98,13 +98,14 @@ static char *mkanonid(void)
     
     home = getenv("HOME");
     if(home && !access(sprintf3("%s/.ashd/sockets/", home), X_OK))
     
     home = getenv("HOME");
     if(home && !access(sprintf3("%s/.ashd/sockets/", home), X_OK))
-       tmpl = sprintf2("%s/.ashd/sockets/scgi-a-XXXXXX");
+       tmpl = sprintf2("%s/.ashd/sockets/scgi-a-XXXXXX", home);
     else
        tmpl = sprintf2("/tmp/scgi-a-%i-XXXXXX", getuid());
     if((fd = mkstemp(tmpl)) < 0) {
        flog(LOG_ERR, "could not create anonymous socket `%s': %s", tmpl, strerror(errno));
        exit(1);
     }
     else
        tmpl = sprintf2("/tmp/scgi-a-%i-XXXXXX", getuid());
     if((fd = mkstemp(tmpl)) < 0) {
        flog(LOG_ERR, "could not create anonymous socket `%s': %s", tmpl, strerror(errno));
        exit(1);
     }
+    close(fd);
     unlink(tmpl);
     return(tmpl);
 }
     unlink(tmpl);
     return(tmpl);
 }