diff options
author | Glenn L McGrath | 2002-11-24 23:22:29 +0000 |
---|---|---|
committer | Glenn L McGrath | 2002-11-24 23:22:29 +0000 |
commit | 5b110874dfa16dc41f31d8b34eef3d721573ca40 (patch) | |
tree | 96d7df0299e91d7b87bae7e6c6cd1405de2df7eb /libbb/make_directory.c | |
parent | 822e7fd587d603b3a47e09d9be5305ccd9cc4c43 (diff) | |
download | busybox-5b110874dfa16dc41f31d8b34eef3d721573ca40.zip busybox-5b110874dfa16dc41f31d8b34eef3d721573ca40.tar.gz |
Dont need a seperate function
Diffstat (limited to 'libbb/make_directory.c')
-rw-r--r-- | libbb/make_directory.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index e25ac21..65be397 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c @@ -38,24 +38,6 @@ * 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); |