diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-24 23:22:29 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-11-24 23:22:29 +0000 |
commit | 5b110874dfa16dc41f31d8b34eef3d721573ca40 (patch) | |
tree | 96d7df0299e91d7b87bae7e6c6cd1405de2df7eb /libbb/make_directory.c | |
parent | 822e7fd587d603b3a47e09d9be5305ccd9cc4c43 (diff) | |
download | busybox-w32-5b110874dfa16dc41f31d8b34eef3d721573ca40.tar.gz busybox-w32-5b110874dfa16dc41f31d8b34eef3d721573ca40.tar.bz2 busybox-w32-5b110874dfa16dc41f31d8b34eef3d721573ca40.zip |
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 e25ac21ee..65be397bf 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -38,24 +38,6 @@ | |||
38 | * Also create parent directories as necessary if flags contains | 38 | * Also create parent directories as necessary if flags contains |
39 | * FILEUTILS_RECUR. */ | 39 | * FILEUTILS_RECUR. */ |
40 | 40 | ||
41 | static mode_t default_permission(char *path, mode_t old_permision) | ||
42 | { | ||
43 | struct stat statbuf; | ||
44 | char *pp; | ||
45 | |||
46 | statbuf.st_mode = 0777; | ||
47 | |||
48 | /* stat the directory */ | ||
49 | pp = strrchr(path, '/'); | ||
50 | if ((pp) && (pp != path)) { | ||
51 | *pp = '\0'; | ||
52 | stat(path, &statbuf); | ||
53 | *pp = '/'; | ||
54 | } | ||
55 | |||
56 | return(statbuf.st_mode & old_permision); | ||
57 | } | ||
58 | |||
59 | int make_directory (char *path, long mode, int flags) | 41 | int make_directory (char *path, long mode, int flags) |
60 | { | 42 | { |
61 | int ret; | 43 | int ret; |
@@ -70,7 +52,19 @@ int make_directory (char *path, long mode, int flags) | |||
70 | } | 52 | } |
71 | 53 | ||
72 | if (mode == -1) { | 54 | if (mode == -1) { |
73 | mode = default_permission(path, 07777); | 55 | struct stat statbuf; |
56 | char *pp = strrchr(path, '/'); | ||
57 | |||
58 | statbuf.st_mode = 0777; | ||
59 | |||
60 | /* stat the directory */ | ||
61 | if ((pp) && (pp != path)) { | ||
62 | *pp = '\0'; | ||
63 | stat(path, &statbuf); | ||
64 | *pp = '/'; | ||
65 | } | ||
66 | |||
67 | mode = statbuf.st_mode; | ||
74 | } | 68 | } |
75 | 69 | ||
76 | ret = mkdir(path, mode); | 70 | ret = mkdir(path, mode); |