From 6e05a0a4e267b2af0d98d208ab86c9e70a7b3262 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Mar 2012 14:11:40 +0000 Subject: [PATCH] - do not setup subsys lock if module load failed Changed files: VirtualBox-vboxdrv.init -> 1.9 VirtualBox-vboxguest.init -> 1.4 --- VirtualBox-vboxdrv.init | 13 +++++++++---- VirtualBox-vboxguest.init | 12 ++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/VirtualBox-vboxdrv.init b/VirtualBox-vboxdrv.init index 4d39d61..26ea84b 100644 --- a/VirtualBox-vboxdrv.init +++ b/VirtualBox-vboxdrv.init @@ -20,11 +20,12 @@ VBOX_MODULE="vboxdrv" setup() { modprobe -s $VBOX_MODULE + RETVAL=$? if [ -d /dev/.udev ]; then - return + return $RETVAL fi - # set proper /dev/vboxdrv for systems with static dev + # set proper $VBOX_DEVICE for systems with static dev show "Setting $VBOX_DEVICE entry"; busy rm -f $VBOX_DEVICE VBOX_MAJOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/devices) @@ -36,17 +37,21 @@ setup() { VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices) fi fi + if [ -z "$VBOX_MAJOR" ]; then /sbin/rmmod $VBOX_MODULE - fail + RETVAL=1 elif ! mknod -m 0660 $VBOX_DEVICE c $VBOX_MAJOR $VBOX_MINOR; then + RETVAL=$? rmmod $VBOX_MODNAME fail elif ! chown root:vbox $VBOX_DEVICE; then + RETVAL=$? fail else ok fi + return $RETVAL } start() { @@ -54,7 +59,7 @@ start() { return fi - setup + setup || exit $? touch /var/lock/subsys/vboxdrv } diff --git a/VirtualBox-vboxguest.init b/VirtualBox-vboxguest.init index 7e36fe2..b014a45 100644 --- a/VirtualBox-vboxguest.init +++ b/VirtualBox-vboxguest.init @@ -20,9 +20,9 @@ VBOX_MODULE="vboxguest" setup() { modprobe -s $VBOX_MODULE - # set proper /dev/vboxdrv for systems with static dev + RETVAL=$? if [ -d /dev/.udev ]; then - return + return $RETVAL fi # set proper $VBOX_DEVICE for systems with static dev @@ -37,24 +37,28 @@ setup() { VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices) fi fi + if [ -z "$VBOX_MAJOR" ]; then /sbin/rmmod $VBOX_MODULE - fail + RETVAL=1 elif ! mknod -m 0660 $VBOX_DEVICE c $VBOX_MAJOR $VBOX_MINOR; then + RETVAL=$? rmmod $VBOX_MODNAME fail elif ! chown root:vbox $VBOX_DEVICE; then + RETVAL=$? fail else ok fi + return $RETVAL } start() { if [ -f /var/lock/subsys/vboxguest ]; then return fi - setup + setup || exit $? touch /var/lock/subsys/vboxguest } -- 2.44.0