Index: trunk/src/sh_entropy.c
===================================================================
--- trunk/src/sh_entropy.c	(revision 30)
+++ trunk/src/sh_entropy.c	(revision 32)
@@ -572,9 +572,13 @@
   char * envp[2];
   size_t len;
+  char   arg0[80];
+  char   arg1[80];
 
   SL_ENTER(_("sh_popen"));
 
-  arg[0] = _("/bin/sh");
-  arg[1] = _("-c");
+  strncpy (arg0, _("/bin/sh"), sizeof(arg0));
+  arg[0] = arg0;
+  strncpy (arg1, _("-c"), sizeof(arg1));
+  arg[1] = arg1;
   arg[2] = command;
   arg[3] = NULL;
@@ -698,15 +702,39 @@
 {
     int status = 0;
+    int retval;
+    char msg[128];
 
     SL_ENTER(_("sh_pclose"));
 
-    status = fclose(source->pipe);
-    if (status)
+    retval = fclose(source->pipe);
+    if (retval)
       {
+	sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, retval, 
+			 MSG_E_SUBGEN,
+			 sh_error_message(retval),
+                         _("sh_pclose"));
 	SL_RETURN((-1), _("sh_pclose"));
       }
 
-    if (waitpid(source->pid, NULL, 0) != source->pid)
-      status = -1;
+    retval = waitpid(source->pid, &status, 0);
+    if (retval != source->pid)
+      {
+	sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, retval, 
+			 MSG_E_SUBGEN,
+			 sh_error_message(retval),
+                         _("sh_pclose"));
+
+	status = -1;
+      }
+    else if (WIFSIGNALED(status))
+      {
+	sl_snprintf(msg, sizeof(msg), _("Subprocess terminated by signal %d"),
+		    WTERMSIG(status));
+	sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, retval, 
+			 MSG_E_SUBGEN,
+			 msg,
+                         _("sh_pclose"));
+	status = -1;
+      }
 
     source->pipe = NULL;
