Browse Source

When creating > 1 files with mktemp(1), make sure that if the creation

of the n'th (n>1) file fails, the previous ones get removed before exit(1)
Idea by jason; ok millert deraadt
OPENBSD_3_3
pvalchev 22 years ago
parent
commit
7eb0a44bce
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      src/etc/daily

+ 5
- 2
src/etc/daily View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $OpenBSD: daily,v 1.41 2002/12/07 20:16:19 millert Exp $
# $OpenBSD: daily,v 1.42 2003/02/08 10:19:30 pvalchev Exp $
# From: @(#)daily 8.2 (Berkeley) 1/25/94
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
@ -13,7 +13,10 @@ if [ -f /etc/daily.local ]; then
fi
TMP=`mktemp /tmp/_daily.XXXXXX` || exit 1
OUT=`mktemp /tmp/_security.XXXXXX` || exit 1
OUT=`mktemp /tmp/_security.XXXXXX` || {
rm -f ${TMP}
exit 1
}
trap 'rm -f $TMP $OUT' 0 1 15


Loading…
Cancel
Save