bug-inetutils
[Top][All Lists]
Advanced

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

Re: [bug-inetutils] [patch] fix busy loop when inetd does not listen for


From: Sergey Poznyakoff
Subject: Re: [bug-inetutils] [patch] fix busy loop when inetd does not listen for any service
Date: Thu, 20 Apr 2006 11:16:41 EEST

Thank you. I've applied the following patch:

Index: inetd.c
===================================================================
RCS file: /cvsroot/inetutils/inetutils/inetd/inetd.c,v
retrieving revision 1.31
diff -p -u -r1.31 inetd.c
--- inetd.c     11 Oct 2005 11:16:13 -0000      1.31
+++ inetd.c     20 Apr 2006 08:14:20 -0000
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, 
Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
    This file is part of GNU Inetutils.
 
@@ -270,8 +271,12 @@ char **config_files;
 
 #if defined(HAVE_SIGACTION)
 # define SIGSTATUS sigset_t
+# define sigstatus_empty(s) sigemptyset(&s)
+# define inetd_pause(s) sigsuspend(&s)
 #else
 # define SIGSTATUS long
+# define sigstatus_empty(s) s = 0
+# define inetd_pause(s) sigpause (s)
 #endif
 
 void
@@ -458,7 +463,8 @@ main (int argc, char *argv[], char *envp
         fclose (fp);
       }
     else
-      syslog (LOG_CRIT, "can't open %s: %s\n", PATH_INETDPID, strerror 
(errno));
+      syslog (LOG_CRIT, "can't open %s: %s\n", PATH_INETDPID,
+             strerror (errno));
   }
 
   signal_set_handler (SIGALRM, retry);
@@ -484,9 +490,12 @@ main (int argc, char *argv[], char *envp
 
       if (nsock == 0)
        {
+         SIGSTATUS stat;
+         sigstatus_empty (stat);
+         
          signal_block (NULL);
          while (nsock == 0)
-           sigpause (0L);
+           inetd_pause (stat);
          signal_unblock (NULL);
        }
       readable = allsock;

Regards,
Sergey
       




reply via email to

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