From 7350ec16241e062482505e56cf2d48a5374f85d8 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sun, 2 Feb 2020 17:07:46 +0100 Subject: [PATCH] warnings in travis --- lib/src/Makefile.in | 4 +++- lib/src/clixon_api_path_parse.y | 2 +- lib/src/clixon_stream.c | 4 ++-- lib/src/clixon_uid.c | 7 +++++-- lib/src/clixon_yang_parse.l | 3 --- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/src/Makefile.in b/lib/src/Makefile.in index 7cf3a045..7eb4189f 100644 --- a/lib/src/Makefile.in +++ b/lib/src/Makefile.in @@ -216,9 +216,11 @@ distclean: clean .c.o: $(GENSRC) rm -f $@ && $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $< +# Compute the length of the date command (and add some extra woith XXX) +DATELEN != date +"%Y.%m.%d %H:%M by `whoami` on `hostname`XXXX"|wc -c .PHONY: build.c build.c: - date +"const char CLIXON_BUILDSTR[64]=\"%Y.%m.%d %H:%M by `whoami` on `hostname`"\"\; > build.c; + date +"const char CLIXON_BUILDSTR[$(DATELEN)]=\"%Y.%m.%d %H:%M by `whoami` on `hostname`"\"\; > build.c; echo "const char CLIXON_VERSION[64]=\"$(CLIXON_VERSION)\""\; >> build.c; $(MYLIB) : $(GENOBJS) $(OBJS) diff --git a/lib/src/clixon_api_path_parse.y b/lib/src/clixon_api_path_parse.y index cff9ee66..7e51cb82 100644 --- a/lib/src/clixon_api_path_parse.y +++ b/lib/src/clixon_api_path_parse.y @@ -228,7 +228,7 @@ keyval_set(char *name, { cg_var *cv = NULL; - clicon_debug(1, "%s(%s=%s)", __FUNCTION__, name, val); + clicon_debug(1, "%s(%s=%s)", __FUNCTION__, name?name:"NULL", val); if ((cv = cv_new(CGV_STRING)) == NULL){ clicon_err(OE_UNIX, errno, "cv_new"); goto done; diff --git a/lib/src/clixon_stream.c b/lib/src/clixon_stream.c index 85e48edd..bcc47bfc 100644 --- a/lib/src/clixon_stream.c +++ b/lib/src/clixon_stream.c @@ -622,7 +622,7 @@ stream_notify_xml(clicon_handle h, cxobj *xev = NULL; cxobj *xml2; /* copy */ yang_stmt *yspec = NULL; - char *str = NULL; + char *str = NULL; /* XXX: never set */ cbuf *cb = NULL; char timestr[28]; struct timeval tv; @@ -644,7 +644,7 @@ stream_notify_xml(clicon_handle h, clicon_err(OE_UNIX, errno, "time2str"); goto done; } - cprintf(cb, "%s%s", timestr, str); + cprintf(cb, "%sNULL", timestr); /* XXX str is always NULL */ if (xml_parse_string(cbuf_get(cb), yspec, &xev) < 0) goto done; if (xml_rootchild(xev, 0, &xev) < 0) diff --git a/lib/src/clixon_uid.c b/lib/src/clixon_uid.c index 21160e4c..7d25c3bc 100644 --- a/lib/src/clixon_uid.c +++ b/lib/src/clixon_uid.c @@ -41,8 +41,10 @@ #include #include #include -#define __USE_GNU /* For setresuid */ -#include +#define _GNU_SOURCE +#define __USE_GNU +#include /* For setresuid */ +#undef _GNU_SOURCE #undef __USE_GNU #include #include @@ -165,6 +167,7 @@ drop_priv_temp(uid_t new_uid) { int retval = -1; + /* XXX: implicit declaration of function 'setresuid' on travis */ if (setresuid(-1, new_uid, geteuid()) < 0){ clicon_err(OE_UNIX, errno, "setresuid"); goto done; diff --git a/lib/src/clixon_yang_parse.l b/lib/src/clixon_yang_parse.l index 1b7c9f46..a359114e 100644 --- a/lib/src/clixon_yang_parse.l +++ b/lib/src/clixon_yang_parse.l @@ -246,9 +246,6 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]* [^'\n]+ { clixon_yang_parselval.string = strdup(yytext); return CHARS;} -[nt"\\] { BEGIN(_YY->yy_lex_state); - clixon_yang_parselval.string = strdup(yytext); - return CHARS; } [nt"\\] { BEGIN(_YY->yy_lex_state); clixon_yang_parselval.string = strdup(yytext); return CHARS; }