From: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: check mktemp return value
Date: Mon, 10 Oct 2011 17:35:43 +0800 [thread overview]
Message-ID: <4E92BC6F.3070805@redhat.com> (raw)
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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
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
next reply other threads:[~2011-10-10 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 9:35 Dave Young [this message]
[not found] ` <4E92BC6F.3070805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-10 9:44 ` check mktemp return value Harald Hoyer
[not found] ` <4E92BE8F.20001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-10 9:53 ` Dave Young
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E92BC6F.3070805@redhat.com \
--to=dyoung-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox