Browse Source

Eliminate some $? tests by rolling the command into the condition

ok halex@
OPENBSD_5_0
guenther 13 years ago
parent
commit
a87068f040
3 changed files with 7 additions and 11 deletions
  1. +3
    -5
      src/etc/netstart
  2. +2
    -3
      src/etc/rc
  3. +2
    -3
      src/etc/weekly

+ 3
- 5
src/etc/netstart View File

@ -1,6 +1,6 @@
#!/bin/sh - #!/bin/sh -
# #
# $OpenBSD: netstart,v 1.132 2011/05/26 15:22:53 mpf Exp $
# $OpenBSD: netstart,v 1.133 2011/07/07 23:09:46 guenther Exp $
# Strip comments (and leading/trailing whitespace if IFS is set) # Strip comments (and leading/trailing whitespace if IFS is set)
# from a file and spew to stdout # from a file and spew to stdout
@ -47,11 +47,9 @@ ifstart() {
chmod -LR o-rwx $file chmod -LR o-rwx $file
chown -LR root.wheel $file chown -LR root.wheel $file
fi fi
ifconfig $if > /dev/null 2>&1
if [ "$?" != "0" ]; then
if ! ifconfig $if > /dev/null 2>&1; then
# Try to create interface if it does not exist # Try to create interface if it does not exist
ifconfig $if create > /dev/null 2>&1
if [ "$?" != "0" ]; then
if ! ifconfig $if create > /dev/null 2>&1; then
return return
fi fi
fi fi


+ 2
- 3
src/etc/rc View File

@ -1,4 +1,4 @@
# $OpenBSD: rc,v 1.363 2011/07/07 22:57:29 deraadt Exp $
# $OpenBSD: rc,v 1.364 2011/07/07 23:09:46 guenther Exp $
# System startup script run by init on autoboot # System startup script run by init on autoboot
# or after single-user. # or after single-user.
@ -518,8 +518,7 @@ fi
if [ ! -f /etc/motd ]; then if [ ! -f /etc/motd ]; then
install -c -o root -g wheel -m 664 /dev/null /etc/motd install -c -o root -g wheel -m 664 /dev/null /etc/motd
fi fi
T=`mktemp /tmp/_motd.XXXXXXXXXX`
if [ $? -eq 0 ]; then
if T=`mktemp /tmp/_motd.XXXXXXXXXX`; then
sysctl -n kern.version | sed 1q > $T sysctl -n kern.version | sed 1q > $T
echo "" >> $T echo "" >> $T
sed '1,/^$/d' < /etc/motd >> $T sed '1,/^$/d' < /etc/motd >> $T


+ 2
- 3
src/etc/weekly View File

@ -1,5 +1,5 @@
# #
# $OpenBSD: weekly,v 1.24 2011/01/19 06:18:05 david Exp $
# $OpenBSD: weekly,v 1.25 2011/07/07 23:09:46 guenther Exp $
# #
# For local additions, create the file /etc/weekly.local. # For local additions, create the file /etc/weekly.local.
# To get section headers, use the function next_part in weekly.local. # To get section headers, use the function next_part in weekly.local.
@ -45,8 +45,7 @@ run_script "weekly.local"
next_part "Rebuilding locate database:" next_part "Rebuilding locate database:"
if [ -f /var/db/locate.database ]; then if [ -f /var/db/locate.database ]; then
TMP=`mktemp /var/db/locate.database.XXXXXXXXXX`
if [ $? -eq 0 ]; then
if TMP=`mktemp /var/db/locate.database.XXXXXXXXXX`; then
trap 'rm -f $TMP; exit 1' 0 1 15 trap 'rm -f $TMP; exit 1' 0 1 15
UPDATEDB="/usr/libexec/locate.updatedb" UPDATEDB="/usr/libexec/locate.updatedb"
echo "${UPDATEDB} --fcodes=- --tmpdir=${TMPDIR:-/var/tmp}" | \ echo "${UPDATEDB} --fcodes=- --tmpdir=${TMPDIR:-/var/tmp}" | \


Loading…
Cancel
Save