about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-04-30 21:23:31 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-04-30 21:23:31 +0000
commit6988fb13dd16f750c7336e3a7fd7422114a44e75 (patch)
tree4fa63b7de95bd0746c3b5ef94a3bca8899a07d33 /lib
parent3432de82ed8357a1e653919c74f1293dfb6c8e07 (diff)
downloadnetpbm-mirror-6988fb13dd16f750c7336e3a7fd7422114a44e75.tar.gz
netpbm-mirror-6988fb13dd16f750c7336e3a7fd7422114a44e75.tar.xz
netpbm-mirror-6988fb13dd16f750c7336e3a7fd7422114a44e75.zip
Release 10.73.10
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@2970 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile13
-rw-r--r--lib/libsystem.c24
-rw-r--r--lib/libsystem_dummy.c16
3 files changed, 40 insertions, 13 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 0097a04e..1e607ee5 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -190,11 +190,14 @@ libnetpbm.$(STATICLIBSUFFIX): $(LIBOBJECTS) $(LIBOBJECTS_X)
 endif
 
 
-# To avoid major hassles with having ppmdcfont available here, we just
-# ship a pre-made standardppmfont.c, so this rule will not normally be
-# used.
-standardppmdfont.c: standard.ppmdfont
-	ppmdcfont <$< >$@
+# To avoid major hassles with having ppmdcfont available here, we just ship a
+# pre-made standardppmfont.c, so this rule will not normally be used.  Though
+# standardppmdfont.c depends upon standard.ppmdfont, we don't declare that
+# here because when the user creates the source tree, the modification time of
+# standard.ppmdfont may end up later than that of standardppmdfont.c, which
+# would make the build want to rebuild it.
+standardppmdfont.c:
+	ppmdcfont <standard.ppmdfont >$@
 
 # Note that we create a new compile.h only for the first make after a
 # make clean.  This is good enough.  We used to do stamp-date for
diff --git a/lib/libsystem.c b/lib/libsystem.c
index 77f874cb..fd3c52ec 100644
--- a/lib/libsystem.c
+++ b/lib/libsystem.c
@@ -407,13 +407,22 @@ pm_system_vp(const char *    const progName,
     */
     
     int progStdinFd;
+        /* File descriptor that the processor program will get as Standard
+           Input
+        */
+    bool weCreatedStdinFd;
+        /* This program created (opened) file descriptor 'progStdinFd',
+           as opposed to inheriting it.
+        */
     pid_t feederPid;
     pid_t processorPid;
 
-    if (stdinFeeder) 
+    if (stdinFeeder) {
         createPipeFeeder(stdinFeeder, feederParm, &progStdinFd, &feederPid);
-    else {
+        weCreatedStdinFd = true;
+    } else {
         progStdinFd = STDIN;
+        weCreatedStdinFd = false;
         feederPid = 0;
     }
 
@@ -426,10 +435,6 @@ pm_system_vp(const char *    const progName,
         spawnProcessor(progName, argArray, progStdinFd, 
                        &progStdoutFd, &processorPid);
 
-        /* The child process has cloned our 'progStdinFd'; we have no
-           more use for our copy.
-        */
-        close(progStdinFd);
         /* Dispose of the stdout from that child */
         (*stdoutAccepter)(progStdoutFd, accepterParm);
         close(progStdoutFd);
@@ -440,6 +445,13 @@ pm_system_vp(const char *    const progName,
         spawnProcessor(progName, argArray, progStdinFd, NULL, &processorPid);
     }
 
+    if (weCreatedStdinFd) {
+        /* The child process has cloned our 'progStdinFd'; we have no
+           more use for our copy.
+        */
+        close(progStdinFd);
+    }
+
     cleanupProcessorProcess(processorPid);
 
     if (feederPid) 
diff --git a/lib/libsystem_dummy.c b/lib/libsystem_dummy.c
index c89b4d5d..97dd8984 100644
--- a/lib/libsystem_dummy.c
+++ b/lib/libsystem_dummy.c
@@ -21,6 +21,12 @@ pm_system_vp(const char *    const progName,
              void *          const feederParm,
              void stdoutAccepter(int, void *),
              void *          const accepterParm) {
+
+    pm_error("This program wants to run another program using pm_system_vp() "
+             "in the libnetpbm library, but libnetpbm was built without "
+             "the pm_system_vp() facility -- probably because this system "
+             "doesn't have the process management facilities pm_system() "
+             "requires.");
 }
 
 void
@@ -30,6 +36,12 @@ pm_system_lp(const char *    const progName,
              void stdoutAccepter(int, void *),
              void *          const accepterParm,
              ...) {
+
+    pm_error("This program wants to run another program using pm_system_lp() "
+             "in the libnetpbm library, but libnetpbm was built without "
+             "the pm_system_lp() facility -- probably because this system "
+             "doesn't have the process management facilities pm_system() "
+             "requires.");
 }
 
 void
@@ -39,8 +51,8 @@ pm_system(void                  stdinFeeder(int, void *),
           void *          const accepterParm,
           const char *    const shellCommand) {
 
-    pm_error("This program wants to run another program using pm_system() in "
-             "the libnetpbm library, but libnetpbm was built without "
+    pm_error("This program wants to run another program using pm_system() "
+             "in the libnetpbm library, but libnetpbm was built without "
              "the pm_system() facility -- probably because this system "
              "doesn't have the process management facilities pm_system() "
              "requires.");