mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
Factor out a makedir function.
This commit is contained in:
parent
4766bae3ae
commit
d75d74b015
1 changed files with 7 additions and 2 deletions
|
|
@ -914,12 +914,17 @@ static char *parent_dir(const char *path)
|
|||
return string_make(path, p + 1);
|
||||
}
|
||||
|
||||
static int makedir(const char *dirname)
|
||||
{
|
||||
return mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
||||
}
|
||||
|
||||
static int makedirs(const char *dirname)
|
||||
{
|
||||
char *parent;
|
||||
int rc;
|
||||
|
||||
rc = mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
||||
rc = makedir(dirname);
|
||||
if (rc == 0 || errno == EEXIST)
|
||||
return 0;
|
||||
|
||||
|
|
@ -932,7 +937,7 @@ static int makedirs(const char *dirname)
|
|||
if (rc == -1)
|
||||
return -1;
|
||||
|
||||
rc = mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
||||
rc = makedir(dirname);
|
||||
if (rc == -1)
|
||||
return -1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue