[PATCH] Fix an erroneous "!" in the test for doKill (#515472)

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

 



This test causes it not to reboot if you don't specify anything about
rebooting in kickstart or on the command line.  It also treats /all/
installs with "nokill" specified as "halt" installs.
---
 loader/kickstart.c |   20 +++++++++++++-------
 loader/loader.c    |    2 ++
 loader/loader.h    |    2 ++
 loader/shutdown.c  |    2 +-
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 36b88fa..3441611 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -524,13 +524,15 @@ static void setSELinux(struct loaderData_s * loaderData, int argc,
 
 static void setPowerOff(struct loaderData_s * loaderData, int argc, 
                         char ** argv) {
-    flags |= LOADER_FLAGS_POWEROFF;
+    if (!FL_NOKILL(flags))
+        flags |= LOADER_FLAGS_POWEROFF;
     return;
 }
 
 static void setHalt(struct loaderData_s * loaderData, int argc, 
                     char ** argv) {
-    flags |= LOADER_FLAGS_HALT;
+    if (!FL_NOKILL(flags))
+        flags |= LOADER_FLAGS_HALT;
     return;
 }
 
@@ -560,12 +562,14 @@ static void setShutdown(struct loaderData_s * loaderData, int argc,
     }
 
 
-    if (poweroff) 
-        flags |= LOADER_FLAGS_POWEROFF;
-    if ((!poweroff && !reboot) || (halt))
+    if (FL_NOKILL(flags)) {
         flags |= LOADER_FLAGS_HALT;
-
-    return;
+    } else  {
+        if (poweroff)
+            flags |= LOADER_FLAGS_POWEROFF;
+        if ((!poweroff && !reboot) || (halt))
+            flags |= LOADER_FLAGS_HALT;
+    }
 }
 
 static void setMediaCheck(struct loaderData_s * loaderData, int argc, 
@@ -586,3 +590,5 @@ void runKickstart(struct loaderData_s * loaderData) {
         }
     }
 }
+
+/* vim:set sw=4 sts=4 et: */
diff --git a/loader/loader.c b/loader/loader.c
index d5d663b..53e00fd 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -902,6 +902,8 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
             flags |= LOADER_FLAGS_ASKNETWORK;
         else if (!strcasecmp(argv[i], "noshell"))
             flags |= LOADER_FLAGS_NOSHELL;
+        else if (!strcasecmp(argv[i], "nokill"))
+            flags |= LOADER_FLAGS_NOKILL;
         else if (!strcasecmp(argv[i], "mediacheck"))
             flags |= LOADER_FLAGS_MEDIACHECK;
         else if (!strcasecmp(argv[i], "allowwireless"))
diff --git a/loader/loader.h b/loader/loader.h
index a38bd49..4808fc8 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -68,6 +68,7 @@
 #define LOADER_FLAGS_IS_KICKSTART       (((uint64_t) 1) << 35)
 #define LOADER_FLAGS_ALLOW_WIRELESS     (((uint64_t) 1) << 36)
 #define LOADER_FLAGS_HAVE_CMSCONF       (((uint64_t) 1) << 37)
+#define LOADER_FLAGS_NOKILL		(((uint64_t) 1) << 38)
 
 #define FL_TESTING(a)            ((a) & LOADER_FLAGS_TESTING)
 #define FL_TEXT(a)               ((a) & LOADER_FLAGS_TEXT)
@@ -103,6 +104,7 @@
 #define FL_IS_KICKSTART(a)       ((a) & LOADER_FLAGS_IS_KICKSTART)
 #define FL_ALLOW_WIRELESS(a)     ((a) & LOADER_FLAGS_ALLOW_WIRELESS)
 #define FL_HAVE_CMSCONF(a)       ((a) & LOADER_FLAGS_HAVE_CMSCONF)
+#define FL_NOKILL(a)		 ((a) & LOADER_FLAGS_NOKILL)
 
 void startNewt(void);
 void stopNewt(void);
diff --git a/loader/shutdown.c b/loader/shutdown.c
index e9d9998..6ae4048 100644
--- a/loader/shutdown.c
+++ b/loader/shutdown.c
@@ -95,7 +95,7 @@ void shutDown(int doKill, reboot_action rebootAction) {
 	if (rebootAction == POWEROFF || rebootAction == REBOOT) {
 		performUnmounts(doKill);
 		performTerminations(doKill);
-		if (!doKill)
+		if (doKill)
 			performReboot(rebootAction);
 	}
 
-- 
1.6.4

_______________________________________________
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