[parisc-linux-cvs] popen/pclose fix for installer

Richard Hirst rhirst@linuxcare.com
Thu, 3 May 2001 14:06:32 +0100


Problem was caused by dbootstrap being invoked with SIGCHLD set to
SIG_IGN.  Needs to be SIG_DFL, otherwise the child is cleared away
before the parent calls pclose to look for it.


Index: utilities/dbootstrap/main.c
===================================================================
RCS file: /home/cvs/parisc/boot-floppies/utilities/dbootstrap/main.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 main.c
--- main.c	2001/05/01 23:19:01	1.1.1.1
+++ main.c	2001/05/03 12:55:28
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/klog.h>
 #ifndef _TESTING_
@@ -584,6 +585,8 @@
     char *term;
     struct serial_struct ser;
 
+    /* SIGCHLD must be DEFAULT and not IGNORE for popen/pclose to work */
+    signal(SIGCHLD, SIG_DFL);
     /* make sure that /proc is mounted */
     check_proc();
     /* Downgrade kernel verbosity */
Index: utilities/dbootstrap/util.c
===================================================================
RCS file: /home/cvs/parisc/boot-floppies/utilities/dbootstrap/util.c,v
retrieving revision 1.2
diff -u -r1.2 util.c
--- util.c	2001/05/01 23:57:13	1.2
+++ util.c	2001/05/03 12:55:29
@@ -31,7 +31,6 @@
 
 int execlog (const char *incmd, int priority)
 { 
-#if !#cpu(hppa)
   FILE *output; 
   char line[MAXLINE]; 
   char cmd[strlen(incmd) + 6]; 
@@ -54,13 +53,6 @@
   }
   closelog();
   return(pclose(output)); 
-#else
-  char cmd[strlen(incmd) + 25];
-  strcpy(cmd, incmd);
-
-  strcat(cmd, " 2>/dev/null > /dev/null" );
-  return system( cmd );
-#endif
 }