Fix print statements when a dir cannot be created

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
Ikey Doherty
2016-05-17 17:20:31 +01:00
parent fc61591870
commit 3a6bf4a167
2 changed files with 10 additions and 6 deletions
+5 -3
View File
@@ -641,11 +641,13 @@ int main(__nc_unused__ int argc, __nc_unused__ char *argv[])
signal(SIGPIPE, SIG_IGN);
for (size_t i = 0; i < ARRAY_SIZE(required_paths); i++) {
if (nc_file_exists(required_paths[i])) {
const char *req_path = required_paths[i];
if (nc_file_exists(req_path)) {
continue;
}
if (!nc_mkdir_p(required_paths[i], 00755)) {
fprintf(stderr, "Failed to mkdir: %s", strerror(errno));
if (!nc_mkdir_p(req_path, 00755)) {
fprintf(stderr, "Failed to mkdir: %s %s\n", strerror(errno), req_path);
return EXIT_FAILURE;
}
}
+5 -3
View File
@@ -301,11 +301,13 @@ int main(__nc_unused__ int argc, __nc_unused__ char **argv)
const char *required_paths[] = { "/var/cache/debuginfo/lib", "/var/cache/debuginfo/src" };
for (size_t i = 0; i < ARRAY_SIZE(required_paths); i++) {
if (nc_file_exists(required_paths[i])) {
const char *req_path = required_paths[i];
if (nc_file_exists(req_path)) {
continue;
}
if (!nc_mkdir_p(required_paths[i], 00755)) {
fprintf(stderr, "Failed to mkdir: %s", strerror(errno));
if (!nc_mkdir_p(req_path, 00755)) {
fprintf(stderr, "Failed to mkdir: %s %s\n", strerror(errno), req_path);
return EXIT_FAILURE;
}
}