diff -uNp -r cpio-2.10.90.old/src/util.c cpio-2.10.90/src/util.c --- cpio-2.10.90.old/src/util.c 2009-02-14 12:39:37 +0000 +++ cpio-2.10.90/src/util.c 2011-09-15 06:11:12.365866297 +0000 @@ -1165,7 +1165,8 @@ sparse_write (int fildes, char *buf, uns } else { - lseek (fildes, seek_count, SEEK_CUR); + if (lseek (fildes, seek_count, SEEK_CUR) == (off_t)-1) + return -1; cur_write_start = buf; write_count = DISKBLOCKSIZE; state = not_in_zeros; @@ -1176,7 +1177,8 @@ sparse_write (int fildes, char *buf, uns case not_in_zeros : if (buf_all_zeros (buf, DISKBLOCKSIZE)) { - write_rc = write (fildes, cur_write_start, write_count); + if (write (fildes, cur_write_start, write_count) != write_count) + return -1; seek_count = DISKBLOCKSIZE; state = in_zeros; } @@ -1197,7 +1199,8 @@ sparse_write (int fildes, char *buf, uns break; case not_in_zeros : - write_rc = write (fildes, cur_write_start, write_count); + if (write (fildes, cur_write_start, write_count) != write_count) + return -1; delayed_seek_count = 0; break; } @@ -1206,10 +1209,12 @@ sparse_write (int fildes, char *buf, uns { if (delayed_seek_count != 0) { - lseek_rc = lseek (fildes, delayed_seek_count, SEEK_CUR); + if (lseek (fildes, delayed_seek_count, SEEK_CUR) == (off_t)-1) + return -1; delayed_seek_count = 0; } - write_rc = write (fildes, buf, leftover_bytes_count); + if (write (fildes, buf, leftover_bytes_count) != leftover_bytes_count) + return -1; } return nbyte; }