X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fmakedir.c;h=ea393852f2aea989977f4f9d9dede79b9e23e83c;hp=a76f9108304a0a99ceb9119778bf57b20ed7669b;hb=c490c51b3c0f8871b6953bd0c74551404f840a74;hpb=2968a0027b4c64664076f0d03a37f9744fe26782 diff --git a/sbr/makedir.c b/sbr/makedir.c index a76f910..ea39385 100644 --- a/sbr/makedir.c +++ b/sbr/makedir.c @@ -19,7 +19,7 @@ int makedir(char *dir) { char path[PATH_MAX]; - char* folder_perms_ASCII; + char *cp; int had_an_error = 0; mode_t folder_perms, saved_umask; register char* c; @@ -27,20 +27,10 @@ makedir(char *dir) context_save(); /* save the context file */ fflush(stdout); - 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 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); + if (!(cp = context_find("folder-protect")) || !*cp) { + cp = foldprot; + } + folder_perms = strtoul(cp, NULL, 8); /* ** Folders have definite desired permissions that are set -- we