fstests: remove tmp files properly

Some tests and common helpers don't properly clean up tmp files and
leave them behind in /tmp dir, and these tmp files are accumulating
over time.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eryu Guan
2017-01-11 17:38:45 +08:00
parent ce4616c888
commit 81aa85deac
4 changed files with 19 additions and 14 deletions
+2 -2
View File
@@ -82,7 +82,7 @@ _scratch_mkfs_xfs()
local mkfs_cmd="`_scratch_mkfs_xfs_opts`"
local mkfs_filter="sed -e '/less than device physical sector/d' \
-e '/switching to logical sector/d'"
local tmp=`mktemp`
local tmp=`mktemp -u`
local mkfs_status
_scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $* 2>$tmp.mkfserr 1>$tmp.mkfsstd
@@ -104,7 +104,7 @@ _scratch_mkfs_xfs()
# output mkfs stdout and stderr
cat $tmp.mkfsstd
cat $tmp.mkfserr >&2
rm -f $tmp*
rm -f $tmp.mkfserr $tmp.mkfsstd
return $mkfs_status
}