[PATCH] Ignore errors upon restoring /lib and /usr after unmounting filesystems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ignore errors upon restoring /lib and /usr after unmounting filesystems,
otherwise these errors always get reported when rebooting before we've
reached stage2. Instead add proper error checking to the execution of
mdadm.

Related: rhbz#598222
---
 loader/shutdown.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/loader/shutdown.c b/loader/shutdown.c
index 8177399..cc8a85f 100644
--- a/loader/shutdown.c
+++ b/loader/shutdown.c
@@ -29,6 +29,7 @@
 #include <sys/reboot.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
 #include "init.h"
@@ -50,7 +51,7 @@ static void performTerminations(void) {
 }
 
 static void performUnmounts(void) {
-	int ignore;
+	int status;
 	struct stat st_buf;
 
 	printf("disabling swap...\n");
@@ -62,23 +63,22 @@ static void performUnmounts(void) {
 	/* We've lost /mnt/runtime where /lib is a link to put the old
 	   /lib back so that our mdadm invocation below works. */
 	if (stat("/lib64", &st_buf) == 0) {
-		if (unlink("/lib64"))
-			perror("unlink /lib64");
-		if (rename("/lib64_old", "/lib64"))
-			perror("rename /lib64_old /lib64");
+		unlink("/lib64");
+		rename("/lib64_old", "/lib64");
 	} else {
-		if (unlink("/lib"))
-			perror("unlink /lib");
-		if (rename("/lib_old", "/lib"))
-			perror("rename /lib_old /lib");
+		unlink("/lib");
+		rename("/lib_old", "/lib");
 	}
-	if (unlink("/usr"))
-		perror("unlink /usr");
-	if (rename("/usr_old", "/usr"))
-		perror("rename /usr_old /usr");
+	unlink("/usr");
+	rename("/usr_old", "/usr");
 
 	printf("waiting for mdraid sets to become clean...\n"); 
-	ignore = system("/sbin/mdadm --wait-clean --scan");
+	status = system("/sbin/mdadm --wait-clean --scan");
+	if (!WIFEXITED(status))
+		printf("Error: mdadm did not terminate normally\n");
+	else if (WEXITSTATUS(status))
+		printf("Error: mdadm exited with status: %d\n",
+		       WEXITSTATUS(status));
 }
 
 static void performReboot(reboot_action rebootAction) {
-- 
1.7.0.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux