Skip to content

Commit

Permalink
Switch to safe_fprintf() for some error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
fragglet committed Apr 1, 2024
1 parent c05d0ae commit 8b99242
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,22 @@ static int check_parent_directory(char *path)
// Create the missing directory:

if (!lha_arch_mkdir(path, 0755)) {
fprintf(stderr,
"Failed to create parent directory %s\n",
path);
safe_fprintf(stderr, "Failed to create parent "
"directory %s", path);
fprintf(stderr, "\n");
return 0;
}
break;

case LHA_FILE_FILE:
fprintf(stderr, "Parent path %s is not a directory!\n",
path);
safe_fprintf(stderr, "Parent path %s is not a "
"directory!", path);
fprintf(stderr, "\n");
return 0;

case LHA_FILE_ERROR:
fprintf(stderr, "Failed to stat %s\n", path);
safe_fprintf(stderr, "Failed to stat %s", path);
fprintf(stderr, "\n");
return 0;
}

Expand Down Expand Up @@ -414,7 +416,9 @@ static int file_exists(char *filename)
file_type = lha_arch_exists(filename);

if (file_type == LHA_FILE_ERROR) {
fprintf(stderr, "Failed to read file type of '%s'\n", filename);
safe_fprintf(stderr, "Failed to read file type of '%s'",
filename);
fprintf(stderr, "\n");
exit(-1);
}

Expand Down

0 comments on commit 8b99242

Please sign in to comment.