automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

install-sh nit: (exit N); exit vs. (exit N); exit N


From: Jim Meyering
Subject: install-sh nit: (exit N); exit vs. (exit N); exit N
Date: Fri, 17 Dec 2004 15:54:25 +0100

Here's a little patch I just applied to coreutils.
I'm not sure the final `exit 0' is necessary, but the others are.
This robustness/portability issue is discussed in autoconf's manual,
but even there, it's not entirely clear that this is the recommended
approach.

2004-12-17  Jim Meyering  <address@hidden>

        * install-sh: Use `(exit N); exit N', not `(exit N); exit'.
        Otherwise, install-sh could exit with improper exit status when
        exiting via a trapped interrupt.  Thanks to a report from Bob Proulx.

Index: lib/install-sh
===================================================================
RCS file: /cvs/automake/automake/lib/install-sh,v
retrieving revision 1.21
diff -u -p -r1.21 install-sh
--- lib/install-sh      22 Oct 2004 06:45:07 -0000      1.21
+++ lib/install-sh      17 Dec 2004 14:48:58 -0000
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2004-10-22.00
+scriptversion=2004-12-17.09
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -296,7 +296,7 @@ do
               || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
               || {
                 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-                (exit 1); exit
+                (exit 1); exit 1
               }
             else
               :
@@ -307,12 +307,12 @@ do
           $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
         }
     }
-  fi || { (exit 1); exit; }
+  fi || { (exit 1); exit 1; }
 done
 
 # The final little trick to "correctly" pass the exit status to the exit trap.
 {
-  (exit 0); exit
+  (exit 0); exit 0
 }
 
 # Local variables:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]