ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [Ethereal-dev] Re: [Ethereal-cvs] cvs commit: ethereal/gtk proto_draw.c rtp_

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Wed, 30 Jun 2004 00:21:48 -0700
On Wed, Jun 30, 2004 at 09:12:12AM +0200, Ulf Lamping wrote:
> ethereal-dev@xxxxxxxxxxxx schrieb am 30.06.04 08:59:28:
> > 
> > guy         2004/06/30 01:58:59 CDT
> > 
> >   Modified files:
> >     gtk                  proto_draw.c rtp_analysis.c 
> >   Log:
> >   On at least some platforms, a #define of O_BINARY is needed even if
> >   <fcntl.h> is included, as <fcntl.h> doesn't define it.
> >   
> 
> What do you mean with some platforms? Some windows platforms?

No, some UNIX platforms (perhaps *all* of them).

> The MSDN states, that fcntl.h will include O_BINARY.

What MSDN states doesn't govern what UN*X platforms do.

> The comment :
> 
> /* Win32 needs the O_BINARY flag for open() */
> 
> should be changed to something more appropriate, like:
> 
> /* Some platforms needs the O_BINARY flag for open() */

No, if it's to be changed at all, it should be changed to something such
as

	/*
	 * On Win32, the "open()" call needs to be given the O_BINARY
	 * flag, so that data read from the file doesn't have 0x15
	 * followed by 0x12 turned into 0x12 and so that 0x12 written
	 * to the file doesn't get turned into 0x15 0x12.
	 *
	 * O_BINARY isn't defined on UN*X, so we have a choice of
	 * #ifdefs selecting one of two "open()" calls (or one of two
	 * flag argument values in the "open()" call) or defining
	 * O_BINARY as 0 on UN*X and using O_BINARY in the call on
	 * all platforms.
	 *
	 * We choose the latter, as it's a bit less messy.
	 */

> And please note, that O_BINARY on Win32 is defined as 0x8000, so
> defining it as 0 will probably cause problems. 

And lease note that the definition as 0 happens only if O_BINARY isn't
otherwise defined; as long as it's done after the include of <fcntl.h>,
that won't be a problem.