[gnome-power-manager/gnome-2-32] Don't try to close a non-opened fd



commit 074178fed01bbac4cc3a5e3f90c573614e4de179
Author: Antoine Jacoutot <ajacoutot openbsd org>
Date:   Tue May 24 12:15:08 2011 +0100

    Don't try to close a non-opened fd
    
    On OpenBSD we do not use /proc. As a result, gnome-power-manager segfaults on
    startup due to a reverse logic in the code.
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 src/gpm-load.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/gpm-load.c b/src/gpm-load.c
index eab0129..3b0f572 100644
--- a/src/gpm-load.c
+++ b/src/gpm-load.c
@@ -192,7 +192,7 @@ gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total)
 	*cpu_total = cpu_user + cpu_nice + cpu_system + *cpu_idle;
 	ret = TRUE;
 out:
-	if (!fd)
+	if (fd)
 		fclose (fd);
 	return ret;
 }



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