refactor(util): log errors from fs_open()

This commit is contained in:
decafcode 2023-12-09 10:10:27 -05:00 committed by decafcode
parent 1bb847c204
commit a9b98c12f1
3 changed files with 5 additions and 5 deletions

View File

@ -95,8 +95,6 @@ int ifs_open(struct ifs **out, const char *path) {
r = fs_open(&ifs->f, path, "rb");
if (r < 0) {
log_write("%s: Error opening file: %s (%i)", path, strerror(-r), r);
goto end;
}

View File

@ -168,8 +168,6 @@ static int ifs_dump_file(struct ifs *ifs, const struct ifs_iter *child,
r = fs_open(&f, path, "wb");
if (r < 0) {
log_write("fopen %s: %s (%i)", path, strerror(-r), r);
goto end;
}

View File

@ -12,6 +12,7 @@
int fs_open(FILE **out, const char *path, const char *mode) {
FILE *f;
int r;
assert(out != NULL);
assert(path != NULL);
@ -21,7 +22,10 @@ int fs_open(FILE **out, const char *path, const char *mode) {
f = fopen(path, mode);
if (f == NULL) {
return -errno;
r = -errno;
log_write("Error opening \"%s\": %s (%i)", path, strerror(-r), r);
return r;
}
*out = f;