diff --git a/src/conky.c b/src/conky.c index 74af1398..fa46ba59 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1774,12 +1774,6 @@ void generate_text_internal(char *p, int p_max_size, OBJ(head) { print_tailhead("head", obj, p, p_max_size); } -#ifdef TCP_PORT_MONITOR - OBJ(tcp_portmon) { - tcp_portmon_action(obj, p, p_max_size); - } -#endif /* TCP_PORT_MONITOR */ - #ifdef HAVE_ICONV OBJ(iconv_start) { do_iconv_start(obj); diff --git a/src/core.c b/src/core.c index 991a18a5..09c8609c 100644 --- a/src/core.c +++ b/src/core.c @@ -1272,6 +1272,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long #ifdef TCP_PORT_MONITOR END OBJ_ARG(tcp_portmon, &tcp_portmon_update, "tcp_portmon: needs arguments") tcp_portmon_init(obj, arg); + obj->callbacks.print = &tcp_portmon_action; obj->callbacks.free = &tcp_portmon_free; #endif /* TCP_PORT_MONITOR */ END OBJ(entropy_avail, &update_entropy) diff --git a/src/tcp-portmon.c b/src/tcp-portmon.c index 97915b6c..b9c7cdbb 100644 --- a/src/tcp-portmon.c +++ b/src/tcp-portmon.c @@ -113,13 +113,13 @@ int tcp_portmon_init(struct text_object *obj, const char *arg) return 0; } -int tcp_portmon_action(struct text_object *obj, char *p, int p_max_size) +void tcp_portmon_action(struct text_object *obj, char *p, int p_max_size) { struct tcp_port_monitor_data *pmd = obj->data.opaque; tcp_port_monitor_t *p_monitor; if (!pmd) - return 1; + return; /* grab a pointer to this port monitor */ p_monitor = find_tcp_port_monitor(pmc, pmd->port_range_begin, @@ -127,16 +127,14 @@ int tcp_portmon_action(struct text_object *obj, char *p, int p_max_size) if (!p_monitor) { snprintf(p, p_max_size, "monitor not found"); - return 1; + return; } /* now grab the text of interest */ if (peek_tcp_port_monitor(p_monitor, pmd->item, pmd->connection_index, p, p_max_size) != 0) { snprintf(p, p_max_size, "monitor peek error"); - return 1; } - return 0; } void tcp_portmon_update(void) diff --git a/src/tcp-portmon.h b/src/tcp-portmon.h index f8af6271..c9e15935 100644 --- a/src/tcp-portmon.h +++ b/src/tcp-portmon.h @@ -39,7 +39,7 @@ struct tcp_port_monitor_data { struct text_object; int tcp_portmon_init(struct text_object *, const char *); -int tcp_portmon_action(struct text_object *, char *, int); +void tcp_portmon_action(struct text_object *, char *, int); void tcp_portmon_update(void); int tcp_portmon_clear(void); int tcp_portmon_set_max_connections(int);