This also affected sum, sha1sum, sha224sum, sha384sum and sha512sum.
[the bug dates back to the initial implementation]
+ mktemp no longer leaves a temporary file behind if it was unable to
+ output the name of the file to stdout.
+ [the bug dates back to the initial implementation]
+
nice -n -1 PROGRAM now runs PROGRAM even when its internal setpriority
call fails with errno == EACCES.
[the bug dates back to the initial implementation]
readutmp
realloc
regex
+ remove
rename
rmdir
root-dev-ino
#include "system.h"
+#include "close-stream.h"
#include "error.h"
#include "filenamecat.h"
#include "quote.h"
}
if (status == EXIT_SUCCESS)
- puts (dest_name);
+ {
+ puts (dest_name);
+ /* If we created a file, but then failed to output the file
+ name, we should clean up the mess before failing. */
+ if (!dry_run && close_stream (stdout))
+ {
+ int saved_errno = errno;
+ remove (dest_name);
+ error (EXIT_FAILURE, saved_errno, _("write error"));
+ }
+ }
#ifdef lint
free (dest_name);
"$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