diff options
Diffstat (limited to 'lib/libfetch/file.c')
-rw-r--r-- | lib/libfetch/file.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libfetch/file.c b/lib/libfetch/file.c index 8569ff3..8c1d404 100644 --- a/lib/libfetch/file.c +++ b/lib/libfetch/file.c @@ -50,12 +50,15 @@ fetchXGetFile(struct url *u, struct url_stat *us, const char *flags) f = fopen(u->doc, "r"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } fcntl(fileno(f), F_SETFD, FD_CLOEXEC); @@ -78,12 +81,15 @@ fetchPutFile(struct url *u, const char *flags) else f = fopen(u->doc, "w+"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } fcntl(fileno(f), F_SETFD, FD_CLOEXEC); |