Ethereal-dev: RE: [ethereal-dev] [PATCH] Saving a temporary file on WIN32

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

From: Jeff Foster <jfoste@xxxxxxxxxxxx>
Date: Thu, 23 Mar 2000 08:32:54 -0600
>Thanks. The corrupt file has 0d:0a where the original had 0a. I see
>the first occurence at byte 0x481 in those files.
>
>It's the CRLF/LF difference again.
>
>When copying the file, we *are* opening the from-file with the O_BINARY
>flag, but the creat() call that we use to create the to-file doesn't
>have such a flag.
>
>(in file.c, the open() is on line 1446, the creat() is on line 1454)
>
>I'll investigate what to do on Win32, but if someone else knows
>offhand, plese tell us!
>
>--gilbert

You could use the open command instead of creat.  You would have to
set the O_CREAT flag -

	to_fd = open( fname, O_CREAT | O_BINARY | O_RDWR, 0644);

The O_RDWR could be set to O_WRONLY depending upon what you are going to
do with the file.

Jeff Foster
jfoste@xxxxxxxxxxxx