30 lines
895 B
Diff
30 lines
895 B
Diff
From 88b3e00515804f7e6906590ab02534d1fe4ec91f Mon Sep 17 00:00:00 2001
|
|
From: Dave Young <dyoung@redhat.com>
|
|
Date: Mon, 10 Oct 2011 11:41:14 +0200
|
|
Subject: [PATCH] dracut: check mktemp return value
|
|
|
|
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 | 4 ++++
|
|
1 files changed, 4 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/dracut b/dracut
|
|
index c9329bd..de13445 100755
|
|
--- 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
|