Skip to content

Commit 76eb742

Browse files
nuclearcatStephen Hemminger
authored and
Stephen Hemminger
committed
fixes for 4.3.3 GCC warnings/errors
After fetching current git code and compiling with gcc 4.3.3 got errors related to Werror (2 functions was ignoring return value), and ulimits.h was not declared, but INT_MAX used Here is fix, so rstp compile fine with gcc 4.3.3 Signed-off-by: Denys Fedoryschenko <denys@visp.net.lb>
1 parent 28be557 commit 76eb742

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

bridge_track.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,19 @@ void delete_if(struct ifdata *ifc)
386386
static int stp_enabled(struct ifdata *br)
387387
{
388388
char path[40 + IFNAMSIZ];
389+
int ret;
389390
sprintf(path, "/sys/class/net/%s/bridge/stp_state", br->name);
390391
FILE *f = fopen(path, "r");
391392
if (!f) {
392393
LOG("Open %s failed", path);
393394
return 0;
394395
}
395396
int enabled = 0;
396-
fscanf(f, "%d", &enabled);
397+
ret = fscanf(f, "%d", &enabled);
398+
if (!ret) {
399+
LOG("%s, stp_state parsing error", path);
400+
return 0;
401+
}
397402
fclose(f);
398403
INFO("STP on %s state %d", br->name, enabled);
399404

ctl_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <sys/types.h>
1717
#include <sys/stat.h>
1818
#include <unistd.h>
19+
#include <limits.h>
1920

2021
#include "ctl_socket_client.h"
2122
#include "ctl_functions.h"

main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ int log_level = LOG_LEVEL_DEFAULT;
4242

4343
int main(int argc, char *argv[])
4444
{
45-
int c;
45+
int c,ret;
4646
while ((c = getopt(argc, argv, "dv:")) != -1) {
4747
switch (c) {
4848
case 'd':
@@ -78,7 +78,11 @@ int main(int argc, char *argv[])
7878
return -1;
7979
}
8080
openlog("rstpd", 0, LOG_DAEMON);
81-
daemon(0, 0);
81+
ret = daemon(0, 0);
82+
if (ret) {
83+
ERROR("daemon() failed");
84+
return -1;
85+
}
8286
is_daemon = 1;
8387
fprintf(f, "%d", getpid());
8488
fclose(f);

netif_utils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <sys/socket.h>
3333
#include <sys/ioctl.h>
3434
#include <fcntl.h>
35+
#include <limits.h>
3536

3637
#include <net/if.h>
3738
#include <linux/if_ether.h>

0 commit comments

Comments
 (0)