Blob Blame History Raw
From 277fbeaa8cdd27e586d1d3d0f58242a0a40b3a48 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 22 Jun 2009 12:51:44 +0200
Subject: [PATCH] s390-tools-1.8.1-cpuplugd-memplug

Description: cpuplugd: Daemon does not work in an memplug only environment.
Symptom:     When the cpuplugd daemon is executed with only the memory
             configuration in cpuplugd.conf it does not start properly.
Problem:     A bug in the configuration file parser prevents this valid
             user specified setup.
Solution:    Adjust the configuration file parser, to accept this type of
             system configuration.
---
 cpuplugd/config.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpuplugd/config.c b/cpuplugd/config.c
index 7f02c6c..93b31e5 100644
--- a/cpuplugd/config.c
+++ b/cpuplugd/config.c
@@ -66,6 +66,7 @@ void parse_configline(struct config *cfg, char *line)
 
 	rc = -1;
 	cmm_min = -1;
+	rvalue = NULL;
 	/* parse line by line */
 	for (token = strtok_r(line, "\n", &save);
 	     token != NULL;
@@ -318,8 +319,7 @@ void check_config(struct config *cfg)
 	int lpar_status, error_counter;
 
 	lpar_status = check_lpar();
-
-	if (cfg->cpu_max <= cfg->cpu_min && cfg->cpu_max != 0) {
+	if (cfg->cpu_max <= cfg->cpu_min && cfg->cpu_max != 0 && cpu != 0) {
 		if (foreground == 1)
 			fprintf(stderr, "cpu_max below or equal cpu_min,"
 					" aborting.\n");
@@ -328,7 +328,6 @@ void check_config(struct config *cfg)
 				"aborting\n");
 		clean_up();
 	}
-
 	if (cfg->cpu_max < 0 || cfg->cpu_min < 0 || cfg->update < 0
 		|| cfg->hotplug == NULL || cfg->hotunplug == NULL) {
 			if (foreground == 1)
@@ -337,6 +336,7 @@ void check_config(struct config *cfg)
 			if (foreground == 0)
 				syslog(LOG_INFO, "No valid CPU hotplug "
 					"configuration detected\n");
+		cpu = 0;
 	} else {
 		cpu = 1;
 		if (debug) {
-- 
1.6.0.6