X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Fmakedir.c;h=4337b7cea06b252a6336bfc6765daedd41632238;hb=6f1a8c3b8d6f19bbe33e7d3fa746ae1d2e9ac455;hp=e4c3c26c15f60baea3645bf6ecadd814d0fe0400;hpb=6e0e2e4490ebb9daf1f62ed7a2d30412551772ee;p=mmh diff --git a/sbr/makedir.c b/sbr/makedir.c index e4c3c26..4337b7c 100644 --- a/sbr/makedir.c +++ b/sbr/makedir.c @@ -2,7 +2,9 @@ /* * 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. */ /* @@ -13,8 +15,6 @@ #include #include #include - -extern int errno; int makedir (char *dir) @@ -30,13 +30,16 @@ makedir (char *dir) fflush(stdout); if (!(folder_perms_ASCII = context_find ("folder-protect"))) - folder_perms_ASCII = foldprot; /* defaults to "0700" */ + folder_perms_ASCII = foldprot; /* defaults to "700" */ - /* Call strtoul() with radix=0, which means it'll determine the base by - looking at the first digit. That way it'll know "0700" is an octal - constant (and if someone gets wacky and changes the representation to hex - it'll still work). */ - folder_perms = strtoul(folder_perms_ASCII, NULL, 0); + /* 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 + strtoul(folder_perms_ASCII, NULL, 0). Therefore, if anyone ever tries to + specify a mode in say, hex, they'll get garbage. (I guess nmh uses its + atooi() function rather than calling strtoul() with a radix of 8 because + some ancient platforms are missing that functionality. */ + folder_perms = atooi(folder_perms_ASCII); /* Folders have definite desired permissions that are set -- we don't want to interact with the umask. Clear it temporarily. */