]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut: check mktemp return value
authorDave Young <dyoung@redhat.com>
Mon, 10 Oct 2011 09:41:14 +0000 (11:41 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 10 Oct 2011 09:41:14 +0000 (11:41 +0200)
in slackware the default mktemp is not from coreutils.
A simply make in test directory mangled my rootfs due
to initdir is blank

Also mktemp could failed with other reason like ENOSPC or EPERM

dracut

diff --git a/dracut b/dracut
index c9329bdf487ca664e7c16774b39a8e39af82cfb8..de13445c605d8623c8e72bd747cc38b226324965 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -472,6 +472,10 @@ fi
 
 readonly TMPDIR=/var/tmp
 readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
+[ -d "$initdir" ] || {
+    dfatal "mktemp failed."
+    exit 1
+}
 
 # clean up after ourselves no matter how we die.
 trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT