Dont need a seperate function
authorGlenn L McGrath <bug1@ihug.co.nz>
Sun, 24 Nov 2002 23:22:29 +0000 (23:22 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Sun, 24 Nov 2002 23:22:29 +0000 (23:22 -0000)
libbb/make_directory.c

index e25ac21eeb60638ef2451e55628c56159b90dd27..65be397bffeb2be4ed41811c1cac2e95b59024cf 100644 (file)
  * Also create parent directories as necessary if flags contains
  * FILEUTILS_RECUR.  */
 
-static mode_t default_permission(char *path, mode_t old_permision)
-{
-       struct stat statbuf;
-       char *pp;
-
-       statbuf.st_mode = 0777;
-
-       /* stat the directory */
-       pp = strrchr(path, '/');
-       if ((pp) && (pp != path)) {
-               *pp = '\0';
-               stat(path, &statbuf);
-               *pp = '/';
-       }
-
-       return(statbuf.st_mode & old_permision);
-}
-
 int make_directory (char *path, long mode, int flags)
 {
        int ret;
@@ -70,7 +52,19 @@ int make_directory (char *path, long mode, int flags)
        }
 
        if (mode == -1) {
-               mode = default_permission(path, 07777);
+               struct stat statbuf;
+               char *pp = strrchr(path, '/');
+
+               statbuf.st_mode = 0777;
+
+               /* stat the directory */
+               if ((pp) && (pp != path)) {
+                       *pp = '\0';
+                       stat(path, &statbuf);
+                       *pp = '/';
+               }
+
+               mode = statbuf.st_mode;
        }
 
        ret = mkdir(path, mode);