All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [Patch] Fix exit code of the sensors tool
@ 2009-01-27  9:00 Andre Prendel
  2009-01-28 13:10 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Prendel @ 2009-01-27  9:00 UTC (permalink / raw)
  To: lm-sensors

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

---

--- lm-sensors-dev/prog/sensors/main.c	2009-01-26 22:49:09.000000000 +0100
+++ my-lm-sensors/prog/sensors/main.c	2009-01-26 22:19:06.000000000 +0100
@@ -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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [lm-sensors] [Patch] Fix exit code of the sensors tool
  2009-01-27  9:00 [lm-sensors] [Patch] Fix exit code of the sensors tool Andre Prendel
@ 2009-01-28 13:10 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2009-01-28 13:10 UTC (permalink / raw)
  To: lm-sensors

Hallo Andre,

On Tue, 27 Jan 2009 10:00:43 +0100, Andre Prendel wrote:
> 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.

> --- lm-sensors-dev/prog/sensors/main.c	2009-01-26 22:49:09.000000000 +0100
> +++ my-lm-sensors/prog/sensors/main.c	2009-01-26 22:19:06.000000000 +0100
> @@ -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);
>  }

Applied, thanks.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-28 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-27  9:00 [lm-sensors] [Patch] Fix exit code of the sensors tool Andre Prendel
2009-01-28 13:10 ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.