On Wednesday 21 of May 2014 11:28:33 Pavel Raiskup wrote:
> On Friday 31 of January 2014 13:07:21 Sergey Poznyakoff wrote:
> > Pavel Raiskup <[email protected]> ha escrit:
> > 
> > > Could we apply at least the first patch?
> > 
> > Yes, of course.  I'm cleaning up the backlogged issues now, so I'll
> > take care of this.
> 
> Ping on this issue?  I got repeated report in Red Hat Bugzilla for this
> issue.
> 
> Link: http://lists.gnu.org/archive/html/bug-cpio/2013-09/msg00006.html

Well, I reobserved the patch and I feel it was wrong.  Better fix is
attached (checking for SAFE_READ_ERROR).

Shouldn't we also switch the 'read()' calls from src utils to 'rmtread()'?
One of the calls is currently unchecked.

Pavel
>From c64164c5ca5063590f220ac78029be6ee3476b0f Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <[email protected]>
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

Reply via email to