[Top][All Lists]

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

[Bug-tar] SA_RESTART, perhaps?

From: Paul Eggert
Subject: [Bug-tar] SA_RESTART, perhaps?
Date: Tue, 27 Sep 2011 13:00:16 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110906 Fedora/3.1.14-1.fc14 Thunderbird/3.1.14

Would it make sense to install the following patch to GNU tar?

The idea here is that I suspect that GNU tar won't work well
if random system calls fail with errno == EINTR, and this
change would help insulate tar from that issue, on platforms
that support SA_RESTART.

This change affects tar's behavior only if the
--totals=SIG option is specified, for some signal SIG.

diff --git a/src/tar.c b/src/tar.c
index 6d37044..f0d8f5b 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -956,10 +956,13 @@ static void
 stat_on_signal (int signo)
+# ifndef SA_RESTART
+#  define SA_RESTART 0
+# endif
   struct sigaction act;
   act.sa_handler = sigstat;
   sigemptyset (&act.sa_mask);
-  act.sa_flags = 0;
+  act.sa_flags = SA_RESTART;
   sigaction (signo, &act, NULL);
   signal (signo, sigstat);

reply via email to

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