Hi Chester,

Based on your review comments and suggestions about the earlier fixes,
reworked on the fix with pselect()
to block the signal.
Blocked the SIGCHLD signal using sigprocmask().

Attached the reworked fix patch for your kind reference.

Please kindly review the patch and suggest your comments.

Thanks,
Thiruvadi Rajaraman


>
Fix for sleep issue in bash loadable builtins

Replaced select() with pselect() and Blocked the 
SIGCHLD signal with sigprocmask() during the sleep process.

Signed-off-by: Thiruvadi Rajaraman <trajara...@mvista.com>

  
Index: bash-4.2/lib/sh/ufuncs.c
===================================================================
--- bash-4.2.orig/lib/sh/ufuncs.c	2009-01-08 19:30:47.000000000 +0530
+++ bash-4.2/lib/sh/ufuncs.c	2017-12-04 15:53:09.576891443 +0530
@@ -19,7 +19,7 @@
 */
 
 #include "config.h"
-
+#include <signal.h>
 #include "bashtypes.h"
 
 #if defined (TIME_WITH_SYS_TIME)
@@ -86,11 +86,20 @@
      unsigned int sec, usec;
 {
   struct timeval tv;
+  sigset_t nmask, omask;
+  int ret;
+
+  sigemptyset(&nmask);
+  sigaddset(&nmask, SIGCHLD);
+  sigprocmask(SIG_BLOCK, &nmask, &omask);
 
   tv.tv_sec = sec;
   tv.tv_usec = usec;
 
-  return select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv);
+  ret = pselect(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv, &nmask);
+  sigprocmask(SIG_SETMASK, &omask, NULL);
+
+  return ret;
 }
 #else /* !HAVE_TIMEVAL || !HAVE_SELECT */
 int

Reply via email to