diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-12-12 09:20:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-12-12 09:20:00 +0000 |
commit | c2e173d16ac5aa279c3b4432abe23c6fb9a948ef (patch) | |
tree | afd224107ece0898f1435dcd56bc4961b7f3efa1 /usr.bin/mkdep | |
parent | bc05e2f082b5be27e0df7a790bc02ff5da3622ca (diff) |
if final cat or mv fails, fail out
Diffstat (limited to 'usr.bin/mkdep')
-rw-r--r-- | usr.bin/mkdep/mkdep.gcc.sh | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/mkdep/mkdep.gcc.sh b/usr.bin/mkdep/mkdep.gcc.sh index eabafc98600..17a974b60d0 100644 --- a/usr.bin/mkdep/mkdep.gcc.sh +++ b/usr.bin/mkdep/mkdep.gcc.sh @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: mkdep.gcc.sh,v 1.6 1997/01/25 14:27:44 niklas Exp $ +# $OpenBSD: mkdep.gcc.sh,v 1.7 1997/12/12 09:19:59 deraadt Exp $ # $NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $ # # Copyright (c) 1991, 1993 @@ -77,6 +77,7 @@ if ! mkdir $DTMP ; then echo failed to create tmp dir $DTMP exit 1 fi + umask $um trap 'rm -rf $DTMP ; exit 1' 1 2 3 13 15 @@ -94,12 +95,19 @@ fi if [ $append = 1 ]; then cat $TMP >> $D - rm -rf $DTMP + if [ $? != 0 ]; then + echo 'mkdep: append failed.' + rm -rf $DTMP + exit 1 + fi else mv $TMP $D - rm -rf $DTMP + if [ $? != 0 ]; then + echo 'mkdep: rename failed.' + rm -rf $DTMP + exit 1 + fi fi -exit 0 - - +rm -rf $DTMP +exit 0 |