directory_create_or_exist is a little different: It does the lstat first and
sets the umask properly, but I think this is more correct than the xx_path()
version before.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
}
trim_string(fname,"","/");
- if (!directory_exist(fname)) {
- if (mkdir(fname,0755) == -1) {
- /* Did someone else win the race ? */
- if (errno != EEXIST) {
- DEBUG(1, ("Unable to create directory %s for file %s. "
- "Error was %s\n", fname, name, strerror(errno)));
- return NULL;
- }
- }
+ if (!directory_create_or_exist(fname, 0755)) {
+ return NULL;
}
return talloc_asprintf_append(fname, "/%s", name);