mirror of
https://github.com/djhackersdev/saltytools.git
synced 2026-03-21 17:54:11 -05:00
refactor(util): log errors from fs_open()
This commit is contained in:
parent
1bb847c204
commit
a9b98c12f1
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user