Canonicalize dirname(3) behavior.

This commit is contained in:
Matt Kraai
2001-08-24 19:51:54 +00:00
parent 2a953aed38
commit ac20ce1924
5 changed files with 25 additions and 13 deletions

View File

@@ -50,13 +50,17 @@ int make_directory (char *path, long mode, int flags)
if (stat (path, &st) < 0 && errno == ENOENT) {
int status;
char *parent = dirname (path);
mode_t mask = umask (0);
char *buf, *parent;
mode_t mask;
mask = umask (0);
umask (mask);
buf = xstrdup (path);
parent = dirname (buf);
status = make_directory (parent, (0777 & ~mask) | 0300,
FILEUTILS_RECUR);
free (parent);
free (buf);
if (status < 0 || make_directory (path, mode, 0) < 0)
return -1;