From e282493095967cc618fb836ebd1884a4198415b4 Mon Sep 17 00:00:00 2001 From: Dave Cornejo Date: Fri, 22 Feb 2019 19:57:42 -1000 Subject: [PATCH] FreeBSD compatibility & pedanticism patches use ETIMEDOUT rather than ETIME - this seems more the intent of its usage here and it compiles under FreeBSD & Linux. in yang_spec_parse_file() the function basename() is not declared, the declaration is in libgen.h, so include it. also basename() takes char * for its argument not const char *, yang_spec_parse_file() has to be changed to char *filename to compile w/o warnings --- .gitignore | 1 + apps/netconf/netconf_main.c | 2 +- lib/clixon/clixon_yang.h | 2 +- lib/src/clixon_yang.c | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3fe9e62a..5784b639 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.o *.so.* +*.so *_parse.tab.c *_parse.tab.h lex.*_parse.c diff --git a/apps/netconf/netconf_main.c b/apps/netconf/netconf_main.c index 27794d65..882e44df 100644 --- a/apps/netconf/netconf_main.c +++ b/apps/netconf/netconf_main.c @@ -312,7 +312,7 @@ static int timeout_fn(int s, void *arg) { - clicon_err(OE_EVENTS, ETIME, "User request timeout"); + clicon_err(OE_EVENTS, ETIMEDOUT, "User request timeout"); return -1; } diff --git a/lib/clixon/clixon_yang.h b/lib/clixon/clixon_yang.h index 1035a429..b0ecb3e1 100644 --- a/lib/clixon/clixon_yang.h +++ b/lib/clixon/clixon_yang.h @@ -281,7 +281,7 @@ int yang_mandatory(yang_stmt *ys); int yang_config(yang_stmt *ys); int yang_spec_parse_module(clicon_handle h, const char *module, const char *revision, yang_spec *yspec); -int yang_spec_parse_file(clicon_handle h, const char *filename, yang_spec *yspec); +int yang_spec_parse_file(clicon_handle h, char *filename, yang_spec *yspec); int yang_spec_load_dir(clicon_handle h, char *dir, yang_spec *yspec); cvec *yang_arg2cvec(yang_stmt *ys, char *delimi); int yang_key_match(yang_node *yn, char *name); diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index 4d977b12..70eeb411 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -69,6 +69,7 @@ #include #include #include +#include /* cligen */ #include @@ -2449,7 +2450,7 @@ yang_spec_parse_module(clicon_handle h, */ int yang_spec_parse_file(clicon_handle h, - const char *filename, + char *filename, yang_spec *yspec) { int retval = -1;