From: Ondrej Zajicek Date: Sun, 9 Oct 2011 23:01:58 +0000 (+0200) Subject: Fixes for include. X-Git-Tag: v1.3.4~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b7fdfc84a516ede415cd1941e5ff1d6312e83ff;p=thirdparty%2Fbird.git Fixes for include. --- diff --git a/conf/cf-lex.l b/conf/cf-lex.l index 79dbab29c..02ba4b394 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -75,6 +75,7 @@ linpool *cfg_mem; int (*cf_read_hook)(byte *buf, unsigned int max, int fd); int (*cf_open_hook)(char *filename); +struct include_file_stack *ifs; #define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max, ifs->conf_fd); #define YY_NO_UNPUT diff --git a/conf/conf.h b/conf/conf.h index df772681a..142c6adea 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -120,7 +120,7 @@ struct include_file_stack { struct include_file_stack *next; }; -struct include_file_stack *ifs; +extern struct include_file_stack *ifs; int cf_lex(void); diff --git a/nest/cli.c b/nest/cli.c index c83a54fee..f9cc0f47e 100644 --- a/nest/cli.c +++ b/nest/cli.c @@ -224,7 +224,7 @@ static int cli_rh_trick_flag; struct cli *this_cli; static int -cli_cmd_read_hook(byte *buf, unsigned int max) +cli_cmd_read_hook(byte *buf, unsigned int max, UNUSED int fd) { if (!cli_rh_trick_flag) { diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 72f7e852a..d6176841a 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -171,11 +171,14 @@ cf_open(char *filename) if (*filename != '/') { snprintf(full_name, sizeof(full_name), "%s/%s", dirname(config_name), filename); + full_name[sizeof(full_name)-1] = 0; cur = full_name; } if ((ret = open(cur, O_RDONLY)) == -1) cf_error("Unable to open included configuration file: %s", cur); + + return ret; }