bug-gnulib
[Top][All Lists]
Advanced

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

spawn-pipe: close() EINTR handling


From: Pádraig Brady
Subject: spawn-pipe: close() EINTR handling
Date: Wed, 03 Jul 2013 12:26:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

So I was reading http://austingroupbugs.net/view.php?id=529
which states on Linux that one shouldn't retry close() after EINTR
as the descriptor is already closed in that case
and another thread could reuse the descriptor
which a retried close() would close erroneously.

That suggests that the following code in spawn-pipe is problematic?
Should be remove the retry, and/or do we need to otherwise
handle the SIGSTOP case?

thanks,
Pádraig.

/* EINTR handling for close().
   These functions can return -1/EINTR even though we don't have any
   signal handlers set up, namely when we get interrupted via SIGSTOP.  */

static int
nonintr_close (int fd)
{
  int retval;

  do
    retval = close (fd);
  while (retval < 0 && errno == EINTR);

  return retval;
}
#define close nonintr_close



reply via email to

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