svn commit: samba r24968 - in branches/SAMBA_3_2_0/source: include libsmb

simo idra at samba.org
Thu Sep 6 12:48:00 GMT 2007


On Thu, 2007-09-06 at 08:10 -0400, Derrell Lipman wrote:
> On 9/5/07, idra at samba.org <idra at samba.org> wrote:
> > Author: idra
> > Date: 2007-09-05 12:53:38 +0000 (Wed, 05 Sep 2007)
> > New Revision: 24968
> >
> > WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24968
> >
> > Log:
> >
> > Fwd port "open" patch
> > --- branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c   2007-09-05 12:53:04 UTC (rev 24967)
> > +++ branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c   2007-09-05 12:53:38 UTC (rev 24968)
> > @@ -5981,7 +5981,7 @@
> >
> >          /* What if the path is empty, or the file exists? */
> >
> > -        return context->open(context, fname, O_WRONLY, 666);
> > +        return (context->open)(context, fname, O_WRONLY, 666);
> >
> >  }
> >
> > @@ -6022,7 +6022,7 @@
> >
> >          /* Try to open the file for reading ... */
> >
> > -        if ((long)(fid1 = c_file->open(c_file, fname, O_RDONLY, 0666)) < 0) {
> > +        if ((long)(fid1 = (c_file->open)(c_file, fname, O_RDONLY, 0666)) < 0) {
> >
> >                  DEBUG(3, ("Error, fname=%s, errno=%i\n", fname, errno));
> >                  return -1;  /* smbc_open sets errno */
> >
> 
> Simo, libsmbclient is full of these (not just with 'open').  Is there
> a general issue that needs addressing for some reason?

No, the glibc devs found out that open() with O_CREAT but without a mode
was not good and changed open() into a macro. This causes gcc to fail to
compile if strict syntax is not used.

This is true only for open right now, but if we have read, write, and
other names that are normally used for file operations it may be worth
thinking to enclose them in parenthesis like in this case to avoid
possible future problems.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org
http://samba.org



More information about the samba-technical mailing list