Some minor lint fixes from PVS-Studio, added Alt workflow
Archlinux build / build-arch (push) Successful in 3m37s
Debian build / build-ubuntu (push) Successful in 3m39s

This commit is contained in:
zx
2025-04-15 23:31:40 +03:00
parent 07edf66b72
commit 2b63aa8cd7
9 changed files with 163 additions and 86 deletions
+12 -2
View File
@@ -13,13 +13,14 @@ CC = @CC@
INCLUDES = -I./include
CFLAGS = @CFLAGS@ -fno-builtin
LIBS = @LIBS@ @CLOCK_LIB@
YACC = @YACC@
YACC = @YACC@ -l
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
SRCDIR = @srcdir@
SRCDIRCONF = $(SRCDIR)/../examples
CONTRIBDIR = $(SRCDIR)/../contrib
CONTRIBMAN = $(SRCDIR)/../man
OWNER = @OWNER@
GROUP = @GROUP@
@@ -27,6 +28,7 @@ CONFDIR = @sysconfdir@
BINDIR = @bindir@
LOGDIR = @LOGDIR@
SPOOLDIR = @SPOOLDIR@
MANDIR = @MANDIR@
DAEMON_LOGFILE = $(LOGDIR)/bf-daemon
BFORCE_LOGFILE = $(LOGDIR)/bf-log
@@ -175,6 +177,7 @@ installdirs:
if [ ! -d $(SPOOLDIR)/bt/out ]; then mkdir -p $(SPOOLDIR)/bt/out; fi
if [ ! -d $(SPOOLDIR)/ndl ]; then mkdir -p $(SPOOLDIR)/ndl; fi
if [ ! -d $(SPOOLDIR)/bforce ]; then mkdir -p $(SPOOLDIR); fi
if [ ! -d $(MANDIR)/man1 ]; then mkdir -p $(MANDIR)/man1; fi
chown $(OWNER):$(GROUP) $(CONFDIR)
chown $(OWNER):$(GROUP) $(LOGDIR)
chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/in
@@ -195,10 +198,17 @@ install-config:
$(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/bforce.passwd $(CONFDIR)/bforce.passwd.sample
$(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.aliases $(CONFDIR)/freq.aliases.sample
$(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.dirs $(CONFDIR)/freq.dirs.sample
install-man:
$(INSTALL) $(CONTRIBMAN)/bforce.1 $(MANDIR)/man1/bforce.1
$(INSTALL) $(CONTRIBMAN)/bfindex.1 $(MANDIR)/man1/bfindex.1
$(INSTALL) $(CONTRIBMAN)/bfstat.1 $(MANDIR)/man1/bforce.1
$(INSTALL) $(CONTRIBMAN)/nlookup.1 $(MANDIR)/man1/bforce.1
$(INSTALL) $(CONTRIBMAN)/outman.1 $(MANDIR)/man1/bforce.1
install-contrib:
$(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(CONTRIBDIR)/outman $(BINDIR)/outman
@echo "Please, edit $(BINDIR)/outman"
install: install-bin install-config
install: install-bin install-config install-man
+3
View File
@@ -810,6 +810,7 @@ int daemon_pidfile(int cmd)
res = fscanf(pf, "%d", &hispid);
if (res != 1) {
log("daemon pidfile: not readable");
fclose(pf);
return -1;
}
@@ -854,6 +855,7 @@ int daemon_pidfile(int cmd)
res = fscanf(pf, "%d", &hispid);
if (res != 1) {
log("daemon pidfile: not readable");
fclose(pf);
return -1;
}
@@ -883,6 +885,7 @@ int daemon_pidfile(int cmd)
res = fscanf(pf, "%d", &hispid);
if (res != 1) {
log("daemon pidfile: not readable");
fclose(pf);
return -1;
}
+6 -7
View File
@@ -32,7 +32,7 @@ int daemon_line_add(const char *name, int type)
int i;
for( i = 0; i < lines_num; i++ )
if( !strcmp(lines_tab[i].name, name) )
if( (lines_tab) && !strcmp(lines_tab[i].name, name) )
return i;
log("register new line \"%s\"", name);
@@ -90,13 +90,12 @@ bool daemon_line_isready(const char *name)
void daemon_lines_deinit(void)
{
int i;
for( i = 0; i < lines_num; i++ )
if( lines_tab[i].name )
free(lines_tab[i].name);
if( lines_tab )
if( lines_tab )
{
for( i = 0; i < lines_num; i++ )
if( lines_tab[i].name )
free(lines_tab[i].name);
free(lines_tab);
lines_tab = NULL;
}
+52 -52
View File
@@ -67,7 +67,7 @@
/* First part of user prologue. */
#line 49 "expression.y"
#include "includes.h"
#include "confread.h"
@@ -110,7 +110,7 @@ static int yyparse(void);
static int yyerror(const char *s);
#line 114 "expression.tab.c"
# ifndef YY_CAST
# ifdef __cplusplus
@@ -1225,25 +1225,25 @@ yyreduce:
switch (yyn)
{
case 2: /* fullline: expression */
#line 94 "expression.y"
{
DEB((D_EVENT, "[yacc] expression return %d", yyvsp[0]));
expr_result = yyvsp[0];
}
#line 1231 "expression.tab.c"
break;
case 3: /* expression: elemexp */
#line 100 "expression.y"
{
DEB((D_EVENT, "[yacc] elemexp return %d", yyvsp[0]));
yyval = yyvsp[0];
}
#line 1240 "expression.tab.c"
break;
case 4: /* expression: NOT expression */
#line 105 "expression.y"
{
DEB((D_EVENT, "[yacc] not exprression %d", yyvsp[0]));
if( (yyvsp[0]) < 0 )
@@ -1251,190 +1251,190 @@ yyreduce:
else
yyval = !(yyvsp[0]);
}
#line 1252 "expression.tab.c"
break;
case 5: /* expression: expression LOGOP expression */
#line 113 "expression.y"
{
yyval = expr_check_logic(yyvsp[-2], yyvsp[-1], yyvsp[0]);
}
#line 1260 "expression.tab.c"
break;
case 6: /* expression: OPENB expression CLOSEB */
#line 117 "expression.y"
{
DEB((D_EVENT, "eventexp: [yacc] backeted.expr %d", yyvsp[-1]));
yyval = yyvsp[-1];
}
#line 1269 "expression.tab.c"
break;
case 7: /* elemexp: INCOMING */
#line 123 "expression.y"
{
yyval = expr_check_incoming();
}
#line 1277 "expression.tab.c"
break;
case 8: /* elemexp: OUTGOING */
#line 127 "expression.y"
{
yyval = expr_check_outgoing();
}
#line 1285 "expression.tab.c"
break;
case 9: /* elemexp: LISTED */
#line 131 "expression.y"
{
yyval = expr_check_listed();
}
#line 1293 "expression.tab.c"
break;
case 10: /* elemexp: PROTECTED */
#line 135 "expression.y"
{
yyval = expr_check_protected();
}
#line 1301 "expression.tab.c"
break;
case 11: /* elemexp: FLAG flagstring */
#line 139 "expression.y"
{
yyval = yyvsp[0];
}
#line 1309 "expression.tab.c"
break;
case 12: /* elemexp: CONNSPEED AROP NUMBER */
#line 143 "expression.y"
{
if( state.valid && state.connspeed > 0 )
yyval = expr_check_arop(state.connspeed, yyvsp[-1], yyvsp[0]);
else
yyval = -1;
}
#line 1320 "expression.tab.c"
break;
case 13: /* elemexp: SPEED AROP NUMBER */
#line 150 "expression.y"
{
if( state.valid && state.node.speed > 0 )
yyval = expr_check_arop(state.node.speed, yyvsp[-1], yyvsp[0]);
else
yyval = -1;
}
#line 1331 "expression.tab.c"
break;
case 14: /* elemexp: TZ AROP NUMBER */
#line 157 "expression.y"
{
yyval = expr_check_arop(time_gmtoffset(), yyvsp[-1], yyvsp[0]);
}
#line 1339 "expression.tab.c"
break;
case 15: /* elemexp: PHONE TEXT */
#line 161 "expression.y"
{
yyval = expr_check_phone(expr_p_text);
}
#line 1347 "expression.tab.c"
break;
case 16: /* elemexp: TIME timestring */
#line 165 "expression.y"
{
yyval = yyvsp[0];
}
#line 1355 "expression.tab.c"
break;
case 17: /* elemexp: EXEC TEXT */
#line 169 "expression.y"
{
yyval = expr_check_exec(expr_p_text);
}
#line 1363 "expression.tab.c"
break;
case 18: /* elemexp: EXIST TEXT */
#line 173 "expression.y"
{
yyval = expr_check_exist(expr_p_text);
}
#line 1371 "expression.tab.c"
break;
case 19: /* elemexp: PORT TEXT */
#line 177 "expression.y"
{
yyval = expr_check_port(expr_p_text);
}
#line 1379 "expression.tab.c"
break;
case 20: /* elemexp: MAILER TEXT */
#line 181 "expression.y"
{
yyval = expr_check_mailer(expr_p_text);
}
#line 1387 "expression.tab.c"
break;
case 21: /* elemexp: TEXT */
#line 185 "expression.y"
{
yyval = expr_check_addr(expr_p_text);
if( yyval == -2 )
YYABORT;
}
#line 1397 "expression.tab.c"
break;
case 22: /* flagstring: TEXT */
#line 192 "expression.y"
{
yyval = expr_check_flag(expr_p_text);
}
#line 1405 "expression.tab.c"
break;
case 23: /* flagstring: TEXT COMMA flagstring */
#line 196 "expression.y"
{
yyval = expr_check_logic(yyvsp[-2], OR, yyvsp[0]);
}
#line 1413 "expression.tab.c"
break;
case 24: /* timestring: TEXT */
#line 201 "expression.y"
{
yyval = expr_check_time(expr_p_text);
if( yyval == -2 )
YYABORT;
}
#line 1423 "expression.tab.c"
break;
case 25: /* timestring: TEXT COMMA timestring */
#line 207 "expression.y"
{
yyval = expr_check_logic(yyvsp[-2], OR, yyvsp[0]);
}
#line 1431 "expression.tab.c"
break;
#line 1435 "expression.tab.c"
default: break;
}
@@ -1627,7 +1627,7 @@ yyreturnlab:
return yyresult;
}
#line 211 "expression.y"
#include "expression_lex.c"
+1 -1
View File
@@ -115,7 +115,7 @@ static void req_readfrlist(char *fname, s_frlist **frlist, int magic)
(*ptrl) = (s_frlist*)xmalloc(sizeof(s_frlist));
memset(*ptrl, '\0', sizeof(s_frlist));
if( path && *path ) (*ptrl)->path = xstrcpy(path);
if( *path ) (*ptrl)->path = xstrcpy(path);
if( !magic && *(path + strlen(path) - 1) != DIRSEPCHR )
{
/* add trailing DIRSEP ('/' or ..) to paths */
+4 -4
View File
@@ -19,7 +19,7 @@
#define DEFAULT_PORT 60179 /* Birthday .. mother fucker :) */
struct addrinfo *ai = NULL;
struct addrinfo *paddrinfo = NULL;
static RETSIGTYPE tcpip_interrupt(int sig)
{
@@ -171,7 +171,7 @@ int tcpip_connect(const char *hostname, e_tcpmode tcpmode)
//aihints.ai_socktype = SOCK_STREAM;
aihints.ai_protocol = IPPROTO_TCP;
nameres = getaddrinfo ( host, port, &aihints, &ai );
nameres = getaddrinfo ( host, port, &aihints, &paddrinfo );
if ( nameres != 0 )
{
rc = 1;
@@ -208,10 +208,10 @@ int tcpip_connect(const char *hostname, e_tcpmode tcpmode)
if( host ) { free(host); host = NULL; }
DEB((D_INFO, "tcpip_connect: resolver got result!"));
aisave = ai;
aisave = paddrinfo;
if (rc == 0 )
rc = tcpip_connect2(ai);
rc = tcpip_connect2(paddrinfo);
freeaddrinfo( aisave );
+1 -1
View File
@@ -3,7 +3,7 @@ dnl
dnl $Id$
dnl
#AC_INIT(bforce/bforce.c)
AC_INIT([bforce],[0.24.1],[zx@zxalexis.ru])
AC_INIT([bforce],[0.26.1],[zx@zxalexis.ru])
AC_CONFIG_HEADER(include/config.h)
AC_CANONICAL_SYSTEM
dnl # Minimum Autoconf version required.