about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-09-01 02:08:26 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2016-09-01 02:08:26 +0000
commitd758cbac11aea1566b8e45e1389ed085eb4d1953 (patch)
tree2cca607a0f8ed785383a0803f435ea192e2ee83c
parentcdb7f9a53206e6d67e764d5a00a553dadcf03669 (diff)
downloadnetpbm-mirror-d758cbac11aea1566b8e45e1389ed085eb4d1953.tar.gz
netpbm-mirror-d758cbac11aea1566b8e45e1389ed085eb4d1953.tar.xz
netpbm-mirror-d758cbac11aea1566b8e45e1389ed085eb4d1953.zip
Use File::Copy::move instead of 'rename' so it works when directories are in different filesystems
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2815 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY6
-rwxr-xr-xeditor/pnmquantall3
2 files changed, 8 insertions, 1 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index cbf142ef..2ddb6f7d 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,6 +6,12 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.76.00
 
+              pnmquantall: Fix failure when temporary file location is
+              not the same filesystem as the output file.
+
+              pnmquantall: Fix incorrect handling of when the Pnmremap or
+              the final rename fails.
+
               giftopnm: Fix bug: crash on little-endian computers that can't
               toleration unaligned memory access.  Thanks Ignatios Souvatzis
               (is@netbsd.org).  Broken in Netpbm 10.47 (June 2009).
diff --git a/editor/pnmquantall b/editor/pnmquantall
index 41cc6721..d268227d 100755
--- a/editor/pnmquantall
+++ b/editor/pnmquantall
@@ -56,6 +56,7 @@ use strict;
 use warnings;
 use English;
 use Fcntl;  # gets open flags
+use File::Copy;
 
 my $TRUE=1; my $FALSE = 0;
 
@@ -176,7 +177,7 @@ sub remapFiles($$$$) {
                 my $newFileName = $inFileName . $ext;
 
                 unlink($newFileName);
-                rename($outputFileName, $newFileName)
+                File::Copy::move($outputFileName, $newFileName)
                     or $$errorR = "Rename to '$newFileName' failed.";
             }
         }