Don't test if symlink exists before 'rm -f'
When the symlink's target doesn't exist, '[ -f' is false, so the symlink doesn't get removed. Since we do always want it to be removed, just call 'rm -f' anyway, which won't complain if the file doesn't exist.
This commit is contained in:
1 parent
2f5a9733b8
commit
bfd5007339
1 file changed
+2
-2
+2
-2
@@ -114,7 +114,7 @@ configure_container_networking() {
|
||||
NSPID=$DOCKERPID
|
||||
|
||||
[ ! -d /var/run/netns ] && mkdir -p /var/run/netns
|
||||
[ -f /var/run/netns/$NSPID ] && rm -f /var/run/netns/$NSPID
|
||||
rm -f /var/run/netns/$NSPID
|
||||
ln -s /proc/$NSPID/ns/net /var/run/netns/$NSPID
|
||||
|
||||
EXITCODE=1
|
||||
@@ -136,7 +136,7 @@ configure_container_networking() {
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -f /var/run/netns/$NSPID ] && rm -f /var/run/netns/$NSPID
|
||||
rm -f /var/run/netns/$NSPID
|
||||
|
||||
return $EXITCODE
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user