Package: bzip2
Version: 1.0.3-6
Severity: normal
Tags: patch

In its one-argument usage ('bzcmp foo.bz2'), bzcmp loses the exit
status, making it rather useless in scripts.  The attached patch fixes
this.  (It also fixes temp file cleanup, by only creating a temp file
in the codepath where it uses and deletes it.)

-- 
Inbound and outbound email scanned for spam and viruses by the
DoubleCheck Email Manager: http://www.doublecheckemail.com/
--- bzcmp
+++ bzcmp
@@ -37,10 +37,6 @@
        echo "Usage: $prog [${comp}_options] file [file]"
        exit 1
 fi
-tmp=`tempfile -d /tmp -p bz` || {
-      echo 'cannot create a temporary file' >&2
-      exit 1
-}
 set $FILES
 if test $# -eq 1; then
        FILE=`echo "$1" | sed 's/.bz2$//'`
@@ -53,6 +49,10 @@
                 case "$2" in
                *.bz2)
                        F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
+                       tmp=`tempfile -d /tmp -p bz` || {
+                               echo 'cannot create a temporary file' >&2
+                               exit 1
+                       }
                         bzip2 -cdfq "$2" > $tmp
                         bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
                         STAT="$?"
@@ -69,8 +69,8 @@
                         STAT="$?";;
                 esac;;
        esac
-        exit "$STAT"
 else
        echo "Usage: $prog [${comp}_options] file [file]"
        exit 1
 fi
+exit "$STAT"

Reply via email to