diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-02-23 16:00:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-02-23 16:00:28 +0000 |
commit | eac71a920a648b88e97b851bac62dc861747a2ae (patch) | |
tree | daeeed0fc10fd5ec5383efea22a56048e3262e57 | |
parent | 67e5025aaf9bc0f1acdc9f45c052ab21b2074510 (diff) | |
download | netpbm-mirror-eac71a920a648b88e97b851bac62dc861747a2ae.tar.gz netpbm-mirror-eac71a920a648b88e97b851bac62dc861747a2ae.tar.xz netpbm-mirror-eac71a920a648b88e97b851bac62dc861747a2ae.zip |
Release 10.47.10
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@1130 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | analyzer/pnmhistmap.c | 2 | ||||
-rw-r--r-- | doc/HISTORY | 7 | ||||
-rw-r--r-- | doc/INSTALL | 2 | ||||
-rw-r--r-- | lib/libsystem.c | 40 | ||||
-rw-r--r-- | version.mk | 2 |
5 files changed, 47 insertions, 6 deletions
diff --git a/analyzer/pnmhistmap.c b/analyzer/pnmhistmap.c index ffcc08f5..7e504734 100644 --- a/analyzer/pnmhistmap.c +++ b/analyzer/pnmhistmap.c @@ -458,7 +458,7 @@ main(int argc, char ** argv) { else hist_width = range; - hscale = (float)hist_width / range; + hscale = (float)(hist_width-1) / (range-1); if (hscale - 1.0 < epsilon && cmdline.verbose) pm_message("Horizontal scale factor: %g (maxval = %u)", hscale, maxval); diff --git a/doc/HISTORY b/doc/HISTORY index db49575e..bc39f5ac 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,13 @@ Netpbm. CHANGE HISTORY -------------- +10.02.23 BJH Release 10.47.10 + + pnmhistmap: Fix crash with -width. Always broken. + + pm_system(): Close extraneous file descriptors that, among + other things, prevent child from seeing EOF. + 10.01.25 BJH Release 10.47.09 pamtosvg: fix bug: occasional crash with out of range error. diff --git a/doc/INSTALL b/doc/INSTALL index 92e78540..ec2cfbed 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -261,6 +261,8 @@ make via the Configure dialog. The standard build is the conventional one. The merge build is a way to reduce disk space and other resource usage in some configurations. +These are rare configurations, mostly antique ones. The advent of +shared libraries largely obsoleted the merge build. In the standard build, hundreds of separate programs get built: ppmtogif, pamcomp, etc. diff --git a/lib/libsystem.c b/lib/libsystem.c index 2ce9b743..8a0f520a 100644 --- a/lib/libsystem.c +++ b/lib/libsystem.c @@ -33,16 +33,44 @@ static void +closeUninheritableFds(int const stdinFd, + int const stdoutFd) { +/*---------------------------------------------------------------------------- + Close all the file descriptors that we declare uninheritable -- files Parent + has open that Child has no business accessing. + + Closing an extra file descriptor is essential to allow the file to close + when Parent closes it. + + We define uninheritable as less than 64 and not Standard Input, Output, + or Error, or 'stdinFd' or 'stdoutFd'. +-----------------------------------------------------------------------------*/ + int fd; + + for (fd = 0; fd < 64; ++fd) { + if (fd == stdinFd) { + } else if (fd == stdoutFd) { + } else if (fd == STDIN_FILENO) { + } else if (fd == STDOUT_FILENO) { + } else if (fd == STDERR_FILENO) { + } else { + close(fd); + } + } +} + + + +static void execProgram(const char * const progName, const char ** const argArray, int const stdinFd, int const stdoutFd) { /*---------------------------------------------------------------------------- - Run the program 'progName' with arguments argArray[], in a child process - with 'stdinFd' as its Standard Input and 'stdoutFd' as its - Standard Output. + Exec the program 'progName' with arguments argArray[], with 'stdinFd' as + its Standard Input and 'stdoutFd' as its Standard Output. - But leave Standard Input and Standard Output as we found them. + But if the exec fails, leave all file descriptors as we found them. Note that stdinFd or stdoutFd may actually be Standard Input and Standard Output already. @@ -58,11 +86,13 @@ execProgram(const char * const progName, stdinSaveFd = dup(STDIN); close(STDIN); dup2(stdinFd, STDIN); + close(stdinFd); } if (stdoutFd != STDOUT) { stdoutSaveFd = dup(STDOUT); close(STDOUT); dup2(stdoutFd, STDOUT); + close(stdoutFd); } rc = execvp(progName, (char **)argArray); @@ -166,6 +196,8 @@ spawnProcessor(const char * const progName, } else stdoutFd = STDOUT; + closeUninheritableFds(stdinFd, stdoutFd); + execProgram(progName, argArray, stdinFd, stdoutFd); close(stdinFd); diff --git a/version.mk b/version.mk index a0a97107..bbe4efbd 100644 --- a/version.mk +++ b/version.mk @@ -1,4 +1,4 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 47 -NETPBM_POINT_RELEASE = 9 +NETPBM_POINT_RELEASE = 10 |