read_wim_header(): Check return value of lseek()
authorEric Biggers <ebiggers3@gmail.com>
Tue, 5 Aug 2014 02:16:46 +0000 (21:16 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 5 Aug 2014 02:17:49 +0000 (21:17 -0500)
src/header.c

index 57cea04..e223ce9 100644 (file)
@@ -96,7 +96,9 @@ read_wim_header(WIMStruct *wim, struct wim_header *hdr)
                        /* Pipable WIM:  Use header at end instead, unless
                         * actually reading from a pipe.  */
                        if (!in_fd->is_pipe) {
-                               lseek(in_fd->fd, -WIM_HEADER_DISK_SIZE, SEEK_END);
+                               ret = WIMLIB_ERR_READ;
+                               if (-1 == lseek(in_fd->fd, -WIM_HEADER_DISK_SIZE, SEEK_END))
+                                       goto read_error;
                                ret = full_read(in_fd, &disk_hdr, sizeof(disk_hdr));
                                if (ret)
                                        goto read_error;