projects
/
am-utils-6.2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a5adcd4
)
partially from Ian Kent: use mktemp for better security.
author
zoulasc
<christos@zoulas.com>
Wed, 26 Mar 2014 19:58:28 +0000
(15:58 -0400)
committer
zoulasc
<christos@zoulas.com>
Wed, 26 Mar 2014 19:58:28 +0000
(15:58 -0400)
scripts/fixrmtab.in
patch
|
blob
|
history
diff --git
a/scripts/fixrmtab.in
b/scripts/fixrmtab.in
index 23003806e4c021af5fa70bc15d0f6e2108ff63b9..8f57e31d2f98b6b512407b7fd1d4dca340de87a9 100755
(executable)
--- a/
scripts/fixrmtab.in
+++ b/
scripts/fixrmtab.in
@@
-10,15
+10,19
@@
#set -x
-RMTAB=/etc/rmtab
-TMP=/tmp/rmtab.$$
-
-if [ ! -f /etc/rmtab ]; then
+if [ ! -f "$RMTAB" ]; then
exit 0
fi
-for host in $*
+RMTAB=/etc/rmtab
+TMP="$(mktemp ${RMTAB}.XXXXXX)"
+if [ -z "$TMP" ]; then
+ exit 1
+fi
+
+trap "rm -f $TMP" 0 1 2 3 15
+
+for host
do
- sed -e
'/^'$host':/s/^./#/' $RMTAB > $TMP && cp $TMP $RMTAB
+ sed -e
"/^$host:/s/^./#/" "$RMTAB" > "$TMP" && cp "$TMP" "$RMTAB"
done
-rm -f $TMP