X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Ffile_io.c;h=26584b9aa6f34f22c4250e1e21ba7fea97b31e2a;hp=3176ce6f64d4ba6e15c4ec6349f55b80be6468ef;hb=d31b2fee211b1c31420bafe1c2379f6f89bd92fe;hpb=dfe54bc93753cf5b878c7d9a6ff7a445de75ad9a diff --git a/src/file_io.c b/src/file_io.c index 3176ce6f..26584b9a 100644 --- a/src/file_io.c +++ b/src/file_io.c @@ -38,7 +38,7 @@ * Return values: * WIMLIB_ERR_SUCCESS (0) * WIMLIB_ERR_READ (errno set) - * WIMLIB_ERR_UNEXPECTED_END_OF_FILE (errno set to 0) + * WIMLIB_ERR_UNEXPECTED_END_OF_FILE (errno set to EINVAL) */ int full_read(struct filedes *fd, void *buf, size_t count) @@ -47,7 +47,7 @@ full_read(struct filedes *fd, void *buf, size_t count) ssize_t ret = read(fd->fd, buf, count); if (unlikely(ret <= 0)) { if (ret == 0) { - errno = 0; + errno = EINVAL; return WIMLIB_ERR_UNEXPECTED_END_OF_FILE; } if (errno == EINTR) @@ -100,7 +100,7 @@ pipe_read(struct filedes *fd, void *buf, size_t count, off_t offset) * Return values: * WIMLIB_ERR_SUCCESS (0) * WIMLIB_ERR_READ (errno set) - * WIMLIB_ERR_UNEXPECTED_END_OF_FILE (errno set to 0) + * WIMLIB_ERR_UNEXPECTED_END_OF_FILE (errno set to EINVAL) * WIMLIB_ERR_RESOURCE_ORDER (errno set to ESPIPE) */ int @@ -113,7 +113,7 @@ full_pread(struct filedes *fd, void *buf, size_t count, off_t offset) ssize_t ret = pread(fd->fd, buf, count, offset); if (unlikely(ret <= 0)) { if (ret == 0) { - errno = 0; + errno = EINVAL; return WIMLIB_ERR_UNEXPECTED_END_OF_FILE; } if (errno == EINTR) @@ -185,18 +185,6 @@ full_pwrite(struct filedes *fd, const void *buf, size_t count, off_t offset) return 0; } -ssize_t -raw_pread(struct filedes *fd, void *buf, size_t count, off_t offset) -{ - return pread(fd->fd, buf, count, offset); -} - -ssize_t -raw_pwrite(struct filedes *fd, const void *buf, size_t count, off_t offset) -{ - return pwrite(fd->fd, buf, count, offset); -} - off_t filedes_seek(struct filedes *fd, off_t offset) { if (fd->is_pipe) {