[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ethereal-dev
Subject:    Re: [ethereal-dev] [PATCH] Saving a file in WIN32 complete
From:       Gilbert Ramirez <gram () xiexie ! org>
Date:       2000-03-23 16:42:23
[Download RAW message or body]

On Thu, Mar 23, 2000 at 09:00:58AM -0600, andreas.sikkema@philips.com wrote:
> 
> 
> 
> This worked for me
> -- 
> Andreas Sikkema
> andreas.sikkema@philips.com
> "Standing barefoot in a river of clues, most people would
>          not get their toes wet." - Brian Kantor in a.s.r.
>  - file.c.patch

This version of the patch, however, gets rid of the need for an #ifdef
since open() will work on Unix, too. For non-Win32 platforms, we set
O_BINARY to 0, so OR-ing it causes no harm.

--gilbert

["file.c.diff" (text/plain)]

Index: file.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/file.c,v
retrieving revision 1.171
diff -u -r1.171 file.c
--- file.c	2000/03/20 04:55:10	1.171
+++ file.c	2000/03/23 16:37:58
@@ -1451,7 +1451,9 @@
 	goto done;
       }
 
-      to_fd = creat(fname, 0644);
+      /* Use open() instead of creat() so that we can pass the O_BINARY
+	 flag, which is relevant on Win32 */
+      to_fd = open(fname, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0644);
       if (to_fd < 0) {
       	err = errno;
 	simple_dialog(ESD_TYPE_WARN, NULL,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic