Re: check mktemp return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 10.10.2011 11:35, Dave Young wrote:
> 
> 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

pushed...

had to hand edit, because your mailer automatically broke the line.
--
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]

Add to Google Powered by Linux