* [Bridge] [PATCH] rstp compiling under gcc 4.3.3 fixes
@ 2009-03-28 14:46 Denys Fedoryschenko
0 siblings, 0 replies; 3+ messages in thread
From: Denys Fedoryschenko @ 2009-03-28 14:46 UTC (permalink / raw)
To: Stephen Hemminger, bridge
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]
Sorry, properly formatted
rstp git tree:
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>
---
[-- Attachment #2: rstp-fixes.diff --]
[-- Type: text/x-diff, Size: 1872 bytes --]
diff -Naur rstp/bridge_track.c rstp-new/bridge_track.c
--- rstp/bridge_track.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/bridge_track.c 2009-03-28 15:30:15.000000000 +0200
@@ -386,6 +386,7 @@
static int stp_enabled(struct ifdata *br)
{
char path[40 + IFNAMSIZ];
+ int ret;
sprintf(path, "/sys/class/net/%s/bridge/stp_state", br->name);
FILE *f = fopen(path, "r");
if (!f) {
@@ -393,7 +394,11 @@
return 0;
}
int enabled = 0;
- fscanf(f, "%d", &enabled);
+ ret = fscanf(f, "%d", &enabled);
+ if (!ret) {
+ LOG("%s, stp_state parsing error", path);
+ return 0;
+ }
fclose(f);
INFO("STP on %s state %d", br->name, enabled);
diff -Naur rstp/ctl_main.c rstp-new/ctl_main.c
--- rstp/ctl_main.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/ctl_main.c 2009-03-28 15:26:33.000000000 +0200
@@ -16,6 +16,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <limits.h>
#include "ctl_socket_client.h"
#include "ctl_functions.h"
diff -Naur rstp/main.c rstp-new/main.c
--- rstp/main.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/main.c 2009-03-28 15:32:12.000000000 +0200
@@ -42,7 +42,7 @@
int main(int argc, char *argv[])
{
- int c;
+ int c,ret;
while ((c = getopt(argc, argv, "dv:")) != -1) {
switch (c) {
case 'd':
@@ -78,7 +78,11 @@
return -1;
}
openlog("rstpd", 0, LOG_DAEMON);
- daemon(0, 0);
+ ret = daemon(0, 0);
+ if (ret) {
+ ERROR("daemon() failed");
+ return -1;
+ }
is_daemon = 1;
fprintf(f, "%d", getpid());
fclose(f);
diff -Naur rstp/netif_utils.c rstp-new/netif_utils.c
--- rstp/netif_utils.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/netif_utils.c 2009-03-28 15:26:06.000000000 +0200
@@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <fcntl.h>
+#include <limits.h>
#include <net/if.h>
#include <linux/if_ether.h>
^ permalink raw reply [flat|nested] 3+ messages in thread* [Bridge] [PATCH] rstp compiling under gcc 4.3.3 fixes
@ 2009-03-28 13:36 Denys Fedoryschenko
2009-03-30 5:09 ` Abhishek Mathur
0 siblings, 1 reply; 3+ messages in thread
From: Denys Fedoryschenko @ 2009-03-28 13:36 UTC (permalink / raw)
To: Stephen Hemminger, bridge
[-- Attachment #1: Type: text/plain, Size: 961 bytes --]
After fetching current git code and compiling with gcc 4.3.3 got errors
Here is fix, so rstp compile fine with gcc 4.3.3
bridge_track.c and main.c have functions where is return value not checked.
Because of -Werror it won't compile.
Example:
gcc -Wall -Werror -O2 -g -D_REENTRANT -D__LINUX__ -DVERSION=0.16 -DBUILD=1 -I. -I./include -I./rstplib -c -o
main.o main.c
cc1: warnings being treated as errors
main.c: In function 'main':
main.c:81: error: ignoring return value of 'daemon', declared with attribute
warn_unused_result
Other fix is missing header file
gcc -Wall -O2 -g -D_REENTRANT -D__LINUX__ -DVERSION=0.16 -DBUILD=1 -I. -I./include -I./rstplib -c -o
netif_utils.o netif_utils.c
netif_utils.c: In function 'get_bridge_portno':
netif_utils.c:130: error: 'INT_MAX' undeclared (first use in this function)
netif_utils.c:130: error: (Each undeclared identifier is reported only once
netif_utils.c:130: error: for each function it appears in.)
[-- Attachment #2: rstp-fixes.diff --]
[-- Type: text/x-diff, Size: 1872 bytes --]
diff -Naur rstp/bridge_track.c rstp-new/bridge_track.c
--- rstp/bridge_track.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/bridge_track.c 2009-03-28 15:30:15.000000000 +0200
@@ -386,6 +386,7 @@
static int stp_enabled(struct ifdata *br)
{
char path[40 + IFNAMSIZ];
+ int ret;
sprintf(path, "/sys/class/net/%s/bridge/stp_state", br->name);
FILE *f = fopen(path, "r");
if (!f) {
@@ -393,7 +394,11 @@
return 0;
}
int enabled = 0;
- fscanf(f, "%d", &enabled);
+ ret = fscanf(f, "%d", &enabled);
+ if (!ret) {
+ LOG("%s, stp_state parsing error", path);
+ return 0;
+ }
fclose(f);
INFO("STP on %s state %d", br->name, enabled);
diff -Naur rstp/ctl_main.c rstp-new/ctl_main.c
--- rstp/ctl_main.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/ctl_main.c 2009-03-28 15:26:33.000000000 +0200
@@ -16,6 +16,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <limits.h>
#include "ctl_socket_client.h"
#include "ctl_functions.h"
diff -Naur rstp/main.c rstp-new/main.c
--- rstp/main.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/main.c 2009-03-28 15:32:12.000000000 +0200
@@ -42,7 +42,7 @@
int main(int argc, char *argv[])
{
- int c;
+ int c,ret;
while ((c = getopt(argc, argv, "dv:")) != -1) {
switch (c) {
case 'd':
@@ -78,7 +78,11 @@
return -1;
}
openlog("rstpd", 0, LOG_DAEMON);
- daemon(0, 0);
+ ret = daemon(0, 0);
+ if (ret) {
+ ERROR("daemon() failed");
+ return -1;
+ }
is_daemon = 1;
fprintf(f, "%d", getpid());
fclose(f);
diff -Naur rstp/netif_utils.c rstp-new/netif_utils.c
--- rstp/netif_utils.c 2009-03-28 15:27:04.000000000 +0200
+++ rstp-new/netif_utils.c 2009-03-28 15:26:06.000000000 +0200
@@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <fcntl.h>
+#include <limits.h>
#include <net/if.h>
#include <linux/if_ether.h>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Bridge] [PATCH] rstp compiling under gcc 4.3.3 fixes
2009-03-28 13:36 Denys Fedoryschenko
@ 2009-03-30 5:09 ` Abhishek Mathur
0 siblings, 0 replies; 3+ messages in thread
From: Abhishek Mathur @ 2009-03-30 5:09 UTC (permalink / raw)
To: Denys Fedoryschenko, Stephen Hemminger,
bridge@lists.linux-foundation.org
Can anybody just send me any diagrammatic representation of the code flow of "rstpd" source code which is an updated version of "rstplib". It will help me a lot to get into the depth of understanding the code ??
Kindly also list some imporatnt differences/updations in "rstpd" as compared to "rstplib"??
-----Original Message-----
From: bridge-bounces@lists.linux-foundation.org [mailto:bridge-bounces@lists.linux-foundation.org] On Behalf Of Denys Fedoryschenko
Sent: Saturday, March 28, 2009 7:07 PM
To: Stephen Hemminger; bridge@lists.linux-foundation.org
Subject: [Bridge] [PATCH] rstp compiling under gcc 4.3.3 fixes
After fetching current git code and compiling with gcc 4.3.3 got errors
Here is fix, so rstp compile fine with gcc 4.3.3
bridge_track.c and main.c have functions where is return value not checked.
Because of -Werror it won't compile.
Example:
gcc -Wall -Werror -O2 -g -D_REENTRANT -D__LINUX__ -DVERSION=0.16 -DBUILD=1 -I. -I./include -I./rstplib -c -o
main.o main.c
cc1: warnings being treated as errors
main.c: In function 'main':
main.c:81: error: ignoring return value of 'daemon', declared with attribute
warn_unused_result
Other fix is missing header file
gcc -Wall -O2 -g -D_REENTRANT -D__LINUX__ -DVERSION=0.16 -DBUILD=1 -I. -I./include -I./rstplib -c -o
netif_utils.o netif_utils.c
netif_utils.c: In function 'get_bridge_portno':
netif_utils.c:130: error: 'INT_MAX' undeclared (first use in this function)
netif_utils.c:130: error: (Each undeclared identifier is reported only once
netif_utils.c:130: error: for each function it appears in.)
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-30 5:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-28 14:46 [Bridge] [PATCH] rstp compiling under gcc 4.3.3 fixes Denys Fedoryschenko
-- strict thread matches above, loose matches on Subject: below --
2009-03-28 13:36 Denys Fedoryschenko
2009-03-30 5:09 ` Abhishek Mathur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox