bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] [PATCH] Make guess_seekable_archive() preserve the errno varia


From: Tetsuo Handa
Subject: [Bug-tar] [PATCH] Make guess_seekable_archive() preserve the errno variable.
Date: Wed, 4 Sep 2013 20:56:40 +0900

Hello.

It seems to me that open_warn() in tar-1.23-3.el6 package sometimes reports
EUNATCH error. I'm trying to confirm that EUNATCH really came from open() (or
its rmt versions). And I noticed that guess_seekable_archive() should preserve
the errno variable. Please consider applying this patch in upstream first.

Regards.
----------------------------------------
>From 20c91719e4a50c8cb54fe5c9268240873dd2287a Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <address@hidden>
Date: Wed, 4 Sep 2013 20:27:06 +0900
Subject: [PATCH] Make guess_seekable_archive() preserve the errno variable.

new_volume() in src/buffer.c calls guess_seekable_archive() which will modify
the errno variable when fstat() failed, making subsequent open_warn() report
errno by fstat() rather than errno by rmtopen().

Signed-off-by: Tetsuo Handa <address@hidden>
---
 src/buffer.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/buffer.c b/src/buffer.c
index 97084ab..8b5d0e9 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -406,6 +406,7 @@ static void
 guess_seekable_archive (void)
 {
   struct stat st;
+  const int err = errno;
 
   if (subcommand_option == DELETE_SUBCOMMAND)
     {
@@ -430,6 +431,7 @@ guess_seekable_archive (void)
     seekable_archive = S_ISREG (st.st_mode);
   else
     seekable_archive = false;
+  errno = err;  
 }
 
 /* Open an archive named archive_name_array[0]. Detect if it is
-- 
1.7.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]