Skip to content

Commit a16cbae

Browse files
Kurt J. Boschteg
Kurt J. Bosch
authored andcommitted
netfs: Refactor to provide meaningful exit code
Get rid of simple if-clauses and provide meaningfull exit code. Maybe someone wants to abort suspend to disk/ram or something if umount fails or even start this in a loop.
1 parent 89a56bd commit a16cbae

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

netfs

+7-14
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,24 @@
44
. /etc/rc.conf
55
. /etc/rc.d/functions
66

7-
rc=0
8-
97
case "$1" in
108
start)
119
stat_busy "Mounting Network Filesystems"
1210
mount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs,davfs
1311
rc=$?
1412
mount -a -O _netdev
15-
if ((rc + $? > 0)); then
16-
stat_fail
17-
else
18-
add_daemon netfs
19-
stat_done
20-
fi
13+
(( rc || $? )) && stat_die
14+
add_daemon netfs
15+
stat_done
2116
;;
2217
stop)
2318
stat_busy "Unmounting Network Filesystems"
2419
umount -a -O _netdev
2520
rc=$?
2621
umount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs,davfs
27-
if ((rc + $? > 0)); then
28-
stat_fail
29-
else
30-
rm_daemon netfs
31-
stat_done
32-
fi
22+
(( rc || $? )) && stat_die
23+
rm_daemon netfs
24+
stat_done
3325
;;
3426
restart)
3527
$0 stop
@@ -38,6 +30,7 @@ case "$1" in
3830
;;
3931
*)
4032
echo "usage: $0 {start|stop|restart}"
33+
exit 1
4134
esac
4235

4336
# vim: set ts=2 noet:

0 commit comments

Comments
 (0)