X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/6c42153ad9362cc676ea66563bf400d7511b3b68..167e542ba3ddb6a8cc2eadf2d88ca482b1e657ce:/sbr/makedir.c diff --git a/sbr/makedir.c b/sbr/makedir.c index 523feb68..67f69c86 100644 --- a/sbr/makedir.c +++ b/sbr/makedir.c @@ -2,8 +2,6 @@ /* * makedir.c -- make a directory * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -14,11 +12,7 @@ */ #include -#include -#include #include - -extern int errno; int makedir (char *dir) @@ -35,7 +29,7 @@ makedir (char *dir) if (!(folder_perms_ASCII = context_find ("folder-protect"))) folder_perms_ASCII = foldprot; /* defaults to "700" */ - + /* Because mh-profile.man documents "Folder-Protect:" as an octal constant, and we don't want to force the user to remember to include a leading zero, we call atooi(folder_perms_ASCII) here rather than @@ -50,7 +44,7 @@ makedir (char *dir) saved_umask = umask(0); if (getuid () == geteuid ()) { - c = strncpy(path, dir, sizeof(path)); + c = strncpy(path, dir, sizeof(path)); while (!had_an_error && (c = strchr((c + 1), '/')) != NULL) { *c = (char)0; @@ -89,22 +83,22 @@ makedir (char *dir) nested directories like the above code can. -- Dan Harkless */ - switch (pid = vfork()) { - case -1: + switch (pid = fork()) { + case -1: advise ("fork", "unable to"); return 0; - case 0: + case 0: setgid (getgid ()); setuid (getuid ()); - execl ("/bin/mkdir", "mkdir", dir, NULL); - execl ("/usr/bin/mkdir", "mkdir", dir, NULL); + execl ("/bin/mkdir", "mkdir", dir, (void *) NULL); + execl ("/usr/bin/mkdir", "mkdir", dir, (void *) NULL); fprintf (stderr, "unable to exec "); perror ("mkdir"); _exit (-1); - default: + default: if (pidXwait(pid, "mkdir")) return 0; break;