Skip to contentSkip to conversation

Fix exit code of the sensors tool

PATCH Applied Andre Prendel 2 participants 2 messages Jan 27, 2009 – Jan 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix exit code of the sensors tool

Hi!

This patch fixes the exit code of the sensors tool in error case (e.g. No sensors found).

Error is set correctly, but at exit label exit() returns res instead of error.

Andre

---

prog/sensors/main.c +2 -2
@@ -243,7 +243,7 @@
 
 int main(int argc, char *argv[])
 {
-	int c, res, i, error, do_bus_list;
+	int c, res, i, error = 0, do_bus_list;
 	const char *config_file_name = NULL;
 
 	struct option long_opts[] =  {
@@ -344,5 +344,5 @@
 
 exit:
 	sensors_cleanup();
-	exit(res);
+	exit(error);
 }

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Applied
#1 lore raw

Hallo Andre,

Quoted 5 lines · Andre Prendel

This patch fixes the exit code of the sensors tool in error case (e.g. No sensors found).

Error is set correctly, but at exit label exit() returns res instead of error.

Good catch, thanks for reporting. Not sure how I missed that.

Quoted 12 lines
prog/sensors/main.c +1 -1
@@ -243,7 +243,7 @@
 
 int main(int argc, char *argv[])
 {
-	int c, res, i, error, do_bus_list;
+	int c, res, i, error = 0, do_bus_list;
 	const char *config_file_name = NULL;
 
 	struct option long_opts[] =  {

prog/sensors/main.c line 348

Quoted 6 lines
prog/sensors/main.c +1 -1
@@ -344,5 +344,5 @@
 
 exit:
 	sensors_cleanup();
-	exit(res);
+	exit(error);
 }

Applied, thanks.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors