diff options
author | Eric Blake <ebb9@byu.net> | 2009-11-04 14:02:20 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-11-05 06:53:21 -0700 |
commit | 41b3a8ed8b2480ca12baaa6c692a7fba3ebd53cf (patch) | |
tree | a75c662443607e08f1d457081957bd4cf25bdbc1 /tests | |
parent | cd65f11c4f5fbfff1f35df56d8afa708c8ac2066 (diff) | |
download | coreutils-41b3a8ed8b2480ca12baaa6c692a7fba3ebd53cf.tar.xz |
mktemp: don't leave file behind on write failure
* src/mktemp.c (main): Remove just-created file if stdout had
problems.
* bootstrap.conf (gnulib_modules): Add remove.
* tests/misc/close-stdout: Test it.
* NEWS: Document it.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/close-stdout | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/misc/close-stdout b/tests/misc/close-stdout index fec1addc8..852c3c822 100755 --- a/tests/misc/close-stdout +++ b/tests/misc/close-stdout @@ -50,12 +50,18 @@ if "$p/src/test" -w /dev/stdout >/dev/null && "$p/src/test" ! -w /dev/stdout >&-; then "$p/src/printf" 'foo' >&- 2>/dev/null && fail=1 cp --verbose a b >&- 2>/dev/null && fail=1 + rm -Rf tmpfile-?????? || fail=1 + mktemp tmpfile-XXXXXX >&- 2>/dev/null && fail=1 + test -e tmpfile-?????? && fail=1 fi # Likewise for /dev/full, if /dev/full works. if test -w /dev/full && test -c /dev/full; then "$p/src/printf" 'foo' >/dev/full 2>/dev/null && fail=1 cp --verbose a b >/dev/full 2>/dev/null && fail=1 + rm -Rf tmpdir-?????? || fail=1 + mktemp -d tmpdir-XXXXXX >/dev/full 2>/dev/null && fail=1 + test -e tmpdir-?????? && fail=1 fi Exit $fail |