- Subject: check mktemp return value
- From: Dave Young <dyoung@xxxxxxxxxx>
- Date: Mon, 10 Oct 2011 17:35:43 +0800
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110323 Thunderbird/3.1.9
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
Signed-off-by: Dave Young <dyoung@xxxxxxxxxx>
---
dracut | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/dracut b/dracut
index c9329bd..8237f7a 100755
--- a/dracut
+++ b/dracut
@@ -472,6 +472,10 @@ fi
readonly TMPDIR=/var/tmp
readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
+[ -z $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
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Home]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]