>From c64164c5ca5063590f220ac78029be6ee3476b0f Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 22 May 2014 14:28:07 +0200 Subject: [PATCH] cpio: check read errors for SAFE_READ_ERROR Check for negative value never catch read fail; setfault fix. * src/util.c (tape_fill_input_buffer): Check for SAFE_READ_ERROR. (disk_fill_input_buffer): Likewise. Original report: https://bugzilla.redhat.com/996150 --- src/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index 18b3e42..70d8ee1 100644 --- a/src/util.c +++ b/src/util.c @@ -206,7 +206,7 @@ tape_fill_input_buffer (int in_des, int num_bytes) get_next_reel (in_des); input_size = rmtread (in_des, input_buffer, num_bytes); } - if (input_size < 0) + if (input_size == SAFE_READ_ERROR) error (PAXEXIT_FAILURE, errno, _("read error")); if (input_size == 0) { @@ -227,7 +227,7 @@ disk_fill_input_buffer (int in_des, off_t num_bytes) in_buff = input_buffer; num_bytes = (num_bytes < DISK_IO_BLOCK_SIZE) ? num_bytes : DISK_IO_BLOCK_SIZE; input_size = read (in_des, input_buffer, num_bytes); - if (input_size < 0) + if (input_size == SAFE_READ_ERROR) { input_size = 0; return (-1); -- 1.9.0