Skip to content

Commit eb83df8

Browse files
authored
Merge pull request #1913 from oalbrigt/configure-fix-enable_ansi-check
configure: fix enable_ansi check
2 parents 04f5e49 + d8d09d1 commit eb83df8

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ dnl System specific options
905905
enable_fatal_warnings=no
906906
fi
907907

908-
if test "x${enable_ansi}" != xno && cc_supports_flag -std=iso9899:199409 ; then
908+
if test "x${enable_ansi}" = xyes && cc_supports_flag -std=iso9899:199409; then
909909
AC_MSG_NOTICE(Enabling ANSI Compatibility)
910910
CC_EXTRAS="$CC_EXTRAS -ansi -D_GNU_SOURCE -DANSI_ONLY"
911911
fi

tools/send_arp.libnet.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ main(int argc, char *argv[])
135135
char* broadcast;
136136
char* netmask;
137137
u_int32_t ip;
138-
u_char src_mac[6];
138+
u_char src_mac[6];
139139
int repeatcount = 1;
140140
int j;
141141
long msinterval = 1000;
142142
int flag;
143-
char pidfilenamebuf[64];
144-
char *pidfilename = NULL;
143+
char *pidfilename = NULL;
144+
int pidflen;
145145
struct sigaction act;
146146

147147
#ifdef HAVE_LIBNET_1_0_API
@@ -201,13 +201,10 @@ main(int argc, char *argv[])
201201
netmask = argv[optind+4];
202202

203203
if (!pidfilename) {
204-
if (snprintf(pidfilenamebuf, sizeof(pidfilenamebuf), "%s%s",
205-
PIDFILE_BASE, ipaddr) >=
206-
(int)sizeof(pidfilenamebuf)) {
207-
cl_log(LOG_INFO, "Pid file truncated");
208-
return EXIT_FAILURE;
209-
}
210-
pidfilename = pidfilenamebuf;
204+
pidflen = strlen(PIDFILE_BASE) + strlen(ipaddr);
205+
pidfilename = calloc(1, pidflen);
206+
snprintf(pidfilename, pidflen, "%s%s",
207+
PIDFILE_BASE, ipaddr);
211208
}
212209

213210
if(write_pid_file(pidfilename) < 0) {

0 commit comments

Comments
 (0)