diff --git a/source/bforce/expression.tab.c b/source/bforce/expression.tab.c index 888251c..13f154b 100644 --- a/source/bforce/expression.tab.c +++ b/source/bforce/expression.tab.c @@ -950,7 +950,7 @@ int yydebug; `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, +yydestruct (char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { YY_USE (yyvaluep); @@ -1059,6 +1059,7 @@ yysetstate: /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyls1 = yyls; yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; @@ -1069,7 +1070,9 @@ yysetstate: yyoverflow (YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF (*yyssp), &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yyls1, yysize * YYSIZEOF (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; } diff --git a/source/bforce/expression.y b/source/bforce/expression.y index 34f7a8f..0dd88b7 100644 --- a/source/bforce/expression.y +++ b/source/bforce/expression.y @@ -360,7 +360,8 @@ static int expr_check_mailer(const char *str) static int expr_check_addr(const char *str) { - s_faddr addr; + s_faddr addr = { 0, 0, 0, 0, 0, '\0' }; + #ifdef DEBUG char abuf1[BF_MAXADDRSTR+1]; char abuf2[BF_MAXADDRSTR+1]; @@ -368,6 +369,7 @@ static int expr_check_addr(const char *str) DEB((D_EVENT, "[yacc] addr: \"%s\" (session with \"%s\")", ftn_addrstr(abuf1, addr), ftn_addrstr(abuf2, state.node.addr))); + #endif if( !state.valid ) diff --git a/source/bforce/logger.c b/source/bforce/logger.c index d62d35b..40783cb 100644 --- a/source/bforce/logger.c +++ b/source/bforce/logger.c @@ -172,7 +172,7 @@ int log_reopen(const char *logname, const char *ext, const char *tty) } -int log(const char *s, ...) +void log(const char *s, ...) { char timestr[40]; @@ -212,10 +212,10 @@ int log(const char *s, ...) va_end(args); - return 0; + //return 0; } -int logerr(const char *s, ...) +void logerr(const char *s, ...) { char timestr[40]; va_list args; @@ -281,7 +281,7 @@ int logerr(const char *s, ...) va_end(args); - return 0; + //return 0; } #endif /* USE_SYSLOG */ @@ -308,7 +308,7 @@ int log_open(const char *logname, const char *ext, const char *tty) p = xstrcat(p, BF_VERSION); int fac = conf_number(cf_syslog_facility); if( tty && *tty ) - strncpy(p, tty, sizeof(p)); + strncpy(p, tty, strlen(p)); openlog(p, LOG_PID, fac); slog_active = TRUE; return 0; @@ -330,7 +330,7 @@ int log_close(void) } -int log(const char *s, ...) +void log(const char *s, ...) { char timestr[40]; @@ -357,10 +357,10 @@ int log(const char *s, ...) va_end(args); - return 0; + //return 0; } -int logerr(const char *s, ...) +void logerr(const char *s, ...) { char timestr[40]; @@ -379,7 +379,7 @@ int logerr(const char *s, ...) va_end(args); - return 0; +// return 0; } #endif /* USE_SYSLOG */ @@ -530,7 +530,7 @@ int debug_close(void) return rc; } -int debug(unsigned long what, const char *str, ...) +void debug(unsigned long what, const char *str, ...) { char buf[40]; va_list args; @@ -554,7 +554,7 @@ int debug(unsigned long what, const char *str, ...) } } - return 0; + //return 0; } #endif /* DEBUG */ diff --git a/source/bforce/os_unix.c b/source/bforce/os_unix.c index 442198a..36317d2 100644 --- a/source/bforce/os_unix.c +++ b/source/bforce/os_unix.c @@ -152,6 +152,7 @@ int exec_redirect_descriptor(int desc, const char *fname, int flags) { log("exec error: cannot open \"%s\" <--> %d (got %d)", fname, desc, fd); + close(fd); return -1; } @@ -329,7 +330,8 @@ int xsystem(const char *command, const char *p_input, const char *p_output) { pid_t pid; int status; - + int fd; + ASSERT(command != NULL); DEB((D_INFO, "xsystem: command \"%s\", input \"%s\", output \"%s\"", @@ -342,27 +344,33 @@ int xsystem(const char *command, const char *p_input, const char *p_output) if( p_input ) { close(0); - if( open(p_input, O_RDONLY) != 0 ) + fd = open(p_input, O_RDONLY); + if( fd != 0 ) { logerr("can't open stdin \"%s\"", p_input); + close(fd); exit(-1); } } if( p_output ) { close(1); - if( open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600) != 1 ) + fd = open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600); + if( fd != 1 ) { logerr("can't open stdout \"%s\"", p_output); + close(fd); exit(-1); } } if( p_output ) { close(2); - if( open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600) != 2 ) + fd = open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600); + if( fd != 2 ) { logerr("can't open stderr \"%s\"", p_output); + close(fd); exit(-1); } } diff --git a/source/include/logger.h b/source/include/logger.h index 0dfb479..7f13b53 100644 --- a/source/include/logger.h +++ b/source/include/logger.h @@ -65,8 +65,8 @@ void log_setident(const char *ident); int log_open(const char *logname, const char *ext, const char *tty); int log_close(void); int log_reopen(const char *logname, const char *ext, const char *tty); -int log(const char *s, ...); -int logerr(const char *s, ...); +void log(const char *s, ...); +void logerr(const char *s, ...); #ifdef DEBUG //void debug_setlevel(long newlevel, bool logit); @@ -75,7 +75,7 @@ bool debug_isopened(void); //int debug_parsestring(char *str, unsigned long *deblevel); int debug_open(); int debug_close(); -int debug(unsigned long what, const char *str, ...); +void debug(unsigned long what, const char *str, ...); void debug_configure(); #endif