aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2017-02-28 09:12:28 +0200
committerSergey Poznyakoff <gray@gnu.org>2017-02-28 09:12:28 +0200
commit6639d5376f5d94f48ba753544adeeb958cef0590 (patch)
tree5b365fbd6049034728c7800e3b1cc3f245888ee7
parentfc751813fb586ab38d712843f610eb175656e66a (diff)
downloadjumper-6639d5376f5d94f48ba753544adeeb958cef0590.tar.gz
jumper-6639d5376f5d94f48ba753544adeeb958cef0590.tar.bz2
Minor fixes
-rw-r--r--src/listener.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/listener.c b/src/listener.c
index 2960dab..230205b 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -292,13 +292,13 @@ listeners_cleanup()
292void 292void
293listener_kve_init(char **kve, int kvn, listener_t *lp, ...) 293listener_kve_init(char **kve, int kvn, listener_t *lp, ...)
294{ 294{
295 int i = 0; 295 int i = 0;
296 static char linebuf[64]; 296 static char linebuf[64];
297 va_list ap; 297 va_list ap;
298 char *p; 298 char *kw, *val;
299 299
300 if (kvn < KVE_MINSIZE) { 300 if (kvn < KVE_MINSIZE) {
301 diag(LOG_CRIT, "%s:%d: INTERNAL ERROR", __FILE__, __LINE__); 301 diag(LOG_CRIT, "%s:%d: INTERNAL ERROR", __FILE__, __LINE__);
302 abort(); 302 abort();
303 } 303 }
304 304
@@ -310,20 +310,20 @@ listener_kve_init(char **kve, int kvn, listener_t *lp, ...)
310 310
311 kve[i++] = "line"; 311 kve[i++] = "line";
312 snprintf(linebuf, sizeof(linebuf), "%u", lp->locus.beg.line); 312 snprintf(linebuf, sizeof(linebuf), "%u", lp->locus.beg.line);
313 kve[i++] = linebuf; 313 kve[i++] = linebuf;
314 314
315 va_start(ap, lp); 315 va_start(ap, lp);
316 while ((p = va_arg(ap,char*))) { 316 while ((kw = va_arg(ap,char*)) && (val = va_arg(ap,char*))) {
317 if (i == kvn) { 317 if (i + 2 >= kvn) {
318 diag(LOG_CRIT, "%s:%d: INTERNAL ERROR", 318 diag(LOG_CRIT, "%s:%d: INTERNAL ERROR",
319 __FILE__, __LINE__); 319 __FILE__, __LINE__);
320 abort(); 320 abort();
321 } 321 }
322 if (p) 322 kve[i++] = kw;
323 kve[i++] = p; 323 kve[i++] = val;
324 } 324 }
325 va_end(ap); 325 va_end(ap);
326 kve[i] = NULL; 326 kve[i] = NULL;
327} 327}
328 328
329static char *event_str[] = { 329static char *event_str[] = {
@@ -474,13 +474,13 @@ listener_print_status(listener_t *lp)
474 lp->status = stat_down; 474 lp->status = stat_down;
475} 475}
476 476
477static int 477static int
478runaction(listener_t *lp, action_t *act, event_t *evt) 478runaction(listener_t *lp, action_t *act, event_t *evt)
479{ 479{
480 char *kve[KVE_MINSIZE + 7]; 480 char *kve[KVE_MINSIZE + 8];
481 char codebuf[64]; 481 char codebuf[64];
482 char statbuf[64]; 482 char statbuf[64];
483 char pidbuf[80], *pid; 483 char pidbuf[80], *pid;
484 484
485 snprintf(statbuf, sizeof(statbuf), "%u", lp->progstat); 485 snprintf(statbuf, sizeof(statbuf), "%u", lp->progstat);
486 snprintf(codebuf, sizeof(codebuf), "%u", evt->code); 486 snprintf(codebuf, sizeof(codebuf), "%u", evt->code);

Return to:

Send suggestions and report system problems to the System administrator.