[Xenomai-git] Henning Schild : scripts: use mktemp instead of relying on TMPDIR beeing in env
Module: xenomai-3 Branch: master Commit: a5cfe9c9a8dbcc094b0c5043b21fa6cde7fc42e5 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a5cfe9c9a8dbcc094b0c5043b21fa6cde7fc42e5 Author: Henning Schild Date: Wed Oct 28 12:15:00 2015 +0100 scripts: use mktemp instead of relying on TMPDIR beeing in env The environment variable TMPDIR is optional and not always set. We could test for it and fall back to /tmp/ or just use the tool mktemp. Signed-off-by: Henning Schild --- scripts/prepare-kernel.sh |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh index 8e960e8..333d11c 100755 --- a/scripts/prepare-kernel.sh +++ b/scripts/prepare-kernel.sh @@ -238,9 +238,9 @@ fi # Create an empty output patch file, and initialize the temporary tree. if test "x$output_patch" != "x"; then -temp_tree=$TMPDIR/prepare-kernel-$$ -if ! mkdir $temp_tree; then - echo Temporary directory $temp_tree already exists, aborting. +temp_tree=`mktemp -d prepare-kernel-XXX --tmpdir` +if [ $? -ne 0 ]; then + echo Temporary directory could not be created. exit 1 fi ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Henning Schild : scripts: use mktemp instead of relying on TMPDIR beeing in env
Module: xenomai-3 Branch: next Commit: a5cfe9c9a8dbcc094b0c5043b21fa6cde7fc42e5 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a5cfe9c9a8dbcc094b0c5043b21fa6cde7fc42e5 Author: Henning Schild Date: Wed Oct 28 12:15:00 2015 +0100 scripts: use mktemp instead of relying on TMPDIR beeing in env The environment variable TMPDIR is optional and not always set. We could test for it and fall back to /tmp/ or just use the tool mktemp. Signed-off-by: Henning Schild --- scripts/prepare-kernel.sh |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh index 8e960e8..333d11c 100755 --- a/scripts/prepare-kernel.sh +++ b/scripts/prepare-kernel.sh @@ -238,9 +238,9 @@ fi # Create an empty output patch file, and initialize the temporary tree. if test "x$output_patch" != "x"; then -temp_tree=$TMPDIR/prepare-kernel-$$ -if ! mkdir $temp_tree; then - echo Temporary directory $temp_tree already exists, aborting. +temp_tree=`mktemp -d prepare-kernel-XXX --tmpdir` +if [ $? -ne 0 ]; then + echo Temporary directory could not be created. exit 1 fi ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git