Avoid strerror() when possible and just rely on warning/error

to handle errno in the proper locale.
This commit is contained in:
Todd C. Miller
2012-11-09 16:32:29 -05:00
parent e28ce01fe0
commit 56de023de8
6 changed files with 27 additions and 16 deletions

View File

@@ -121,7 +121,8 @@ mkdir_parents(char *path)
if (mkdir(path, S_IRWXU) != 0)
log_fatal(USE_ERRNO, N_("unable to mkdir %s"), path);
} else if (!S_ISDIR(sb.st_mode)) {
log_fatal(0, N_("%s: %s"), path, strerror(ENOTDIR));
errno = ENOTDIR;
log_fatal(USE_ERRNO, "%s", path);
}
*slash = '/';
}