mirror of
https://github.com/sheumann/hush.git
synced 2025-01-04 22:34:37 +00:00
Dont need a seperate function
This commit is contained in:
parent
822e7fd587
commit
5b110874df
@ -38,24 +38,6 @@
|
|||||||
* Also create parent directories as necessary if flags contains
|
* Also create parent directories as necessary if flags contains
|
||||||
* FILEUTILS_RECUR. */
|
* 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 make_directory (char *path, long mode, int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -70,7 +52,19 @@ int make_directory (char *path, long mode, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode == -1) {
|
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);
|
ret = mkdir(path, mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user