X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=overlord.c;h=2ae825021c67f6e975ed0476688da2fe6cda6da8;hb=f53cd40f20431be077e96cb70e6dae9692276356;hp=3ba4114008d041db558a90196c4ecc2369edec57;hpb=a3188674ee2386b7b2ca66116f9bcce71b32a9dd;p=userv.git diff --git a/overlord.c b/overlord.c index 3ba4114..2ae8250 100644 --- a/overlord.c +++ b/overlord.c @@ -68,7 +68,7 @@ static void checkstalepipes(void) { if (time(&now) == -1) { syslog(LOG_ERR,"get current time: %m"); return; } dir= opendir("."); if (!dir) { syslog(LOG_ERR,"open directory " VARDIR ": %m"); return; } - while ((de= readdir(dir))) { + while ((errno=0, de= readdir(dir))) { if (fnmatch(PIPEPATTERN,de->d_name,FNM_PATHNAME|FNM_PERIOD)) continue; r= lstat(de->d_name,&stab); if (r && errno==ENOENT) continue; if (r) { syslog(LOG_ERR,"could not stat `" VARDIR "/%s': %m",de->d_name); continue; } @@ -77,12 +77,13 @@ static void checkstalepipes(void) { if (unlink(de->d_name) && errno!=ENOENT) syslog(LOG_ERR,"could not remove stale pipe `%s': %m",de->d_name); } + if (errno) syslog(LOG_ERR,"read directory " VARDIR ": %m"); if (closedir(dir)) syslog(LOG_ERR,"close directory " VARDIR ": %m"); } static void sighandler_chld(int x) { pid_t r; - int status, es, ar; + int status, es; es= errno; for (;;) { @@ -262,7 +263,8 @@ static void NONRETURNING startupsyscallerr(const char *what) { } int main(int argc, char *const *argv) { - int mfd, sfd, nfd, csocklen, e, r, becomedaemon; + int mfd, sfd, nfd, e, r, becomedaemon; + socklen_t csocklen; struct sigaction sigact; struct sockaddr_un ssockname, csockname; pid_t child, parentpid, sid;