On Tue, 2005-03-15 at 19:25 +0100, Iago Rubio wrote: > On Tue, 2005-03-15 at 11:03 -0600, Brian Millett wrote: > > On Tue, 2005-03-15 at 17:55 +0100, Iago Rubio wrote: > > > On Tue, 2005-03-15 at 09:55 -0600, Brian Millett wrote: > > > > Had to make some cosmetic patches to get it to compile with gcc4 and I > > > > am sure they are "wrong" but it compiled. > > > > > > > > [bpm]$ diff -wruN nm-netlink-monitor.c~ nm-netlink-monitor.c > > > > --- nm-netlink-monitor.c~ 2005-03-14 23:30:14.000000000 -0600 > > > > +++ nm-netlink-monitor.c 2005-03-15 09:39:23.000000000 -0600 > > > > @@ -568,10 +568,10 @@ > > > > NmNetlinkMonitor *monitor) > > > > { > > > > GError *error; > > > > - gchar *received_bytes; > > > > + gchar *received_bytes=""; > > > > gboolean processing_is_done; > > > > - gsize num_received_bytes; > > > > - guint num_bytes_to_process; > > > > + gsize num_received_bytes=0; > > > > + guint num_bytes_to_process=0; > > > > struct nlmsghdr *header; > > > > > > Frankly, I don't see how this could fix the build. > > > > > > May be it's being used -Werror in the gcc command line ? > > > > Why yes it is. (from Makefile) > > CC = gcc > > CCDEPMODE = depmode=gcc3 > > CFLAGS = -Wall -Werror -std=gnu89 -g -O2 -Wno-unused > > -Wno-strict-aliasing -Wno-sign-compare -Wdeclaration-after-statement > > -Wno-pointer-sign > > CPP = gcc -E > > > > So I do not know what or why the difference. > > -Werror will stop compilation on warnings. > > I think it should be better to take out the -Werror and let the sources > untouched, as to randomly initialize variables could make things fail. > > Taking out -Werror, you will be able to compile, and will let the > warnings inform other developers about this problem. > > Initializing the variables this way you achieve the opposite of what the > developer wanted. He wanted to care of small glitches so he decided to > convert warnings in error. > > You're blindly hiding the warnings, and it can make debugging more > painful. > > In the case you don't care about this, I recommend at least initialize > also the gchar* variable to 0. > > gchar *received_bytes=0; > > This way if it's g_freed anywhere - at least - it won't segfault. > > Just my 2 - euro - cents. Muchicimas gracias. -- Brian Millett - [ Londo, "Believers"] "Unfortunately, we *are* on a budget here."
Attachment:
signature.asc
Description: This is a digitally signed message part