From 75ce3b259be20f4a304fbf90d7c5f55871c872da Mon Sep 17 00:00:00 2001 From: Cesare Tirabassi Date: Thu, 3 Sep 2009 23:13:14 +0200 Subject: [PATCH] Fix if_running not working on linux when a top flavour is not running --- src/conky.c | 6 ++++++ src/conky.h | 3 +++ src/core.c | 1 + src/top.c | 1 + 4 files changed, 11 insertions(+) diff --git a/src/conky.c b/src/conky.c index 4df492bb..59987dad 100644 --- a/src/conky.c +++ b/src/conky.c @@ -146,6 +146,9 @@ int top_cpu, top_mem, top_time; #ifdef IOSTATS int top_io; #endif +#ifdef __linux__ +int top_running; +#endif static unsigned int top_name_width = 15; int output_methods; static int extra_newline; @@ -5053,6 +5056,9 @@ static void set_default_configurations(void) #ifdef IOSTATS top_io = 0; #endif +#ifdef __linux__ + top_running = 0; +#endif #ifdef MPD mpd_env_host = getenv("MPD_HOST"); mpd_env_port = getenv("MPD_PORT"); diff --git a/src/conky.h b/src/conky.h index cb85afd9..7e841c5b 100644 --- a/src/conky.h +++ b/src/conky.h @@ -370,6 +370,9 @@ extern int top_cpu, top_mem, top_time; #ifdef IOSTATS extern int top_io; #endif +#ifdef __linux__ +extern int top_running; +#endif /* defined in conky.c, needed by top.c */ extern int cpu_separate; diff --git a/src/core.c b/src/core.c index 54621f50..aa7c8e69 100644 --- a/src/core.c +++ b/src/core.c @@ -1124,6 +1124,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long #ifdef __linux__ END OBJ_IF(if_running, INFO_TOP) if (arg) { + top_running = 1; obj->data.ifblock.s = strndup(arg, text_buffer_size); #else END OBJ_IF(if_running, 0) diff --git a/src/top.c b/src/top.c index c363ee73..f4683ee0 100644 --- a/src/top.c +++ b/src/top.c @@ -670,6 +670,7 @@ void process_find_top(struct process **cpu, struct process **mem, #ifdef IOSTATS && !top_io #endif /* IOSTATS */ + && !top_running ) { return; }