creat() is equivalent to open() with the flags O_CREAT | O_WRONLY | O_TRUNC.
authorColin Finck <colin@reactos.org>
Thu, 7 Feb 2008 14:53:03 +0000 (14:53 +0000)
committerColin Finck <colin@reactos.org>
Thu, 7 Feb 2008 14:53:03 +0000 (14:53 +0000)
Use these flags and O_BINARY to replace the creat() call we previously had.

Requested by Wine for patch acceptance

svn path=/trunk/; revision=32187

reactos/tools/widl/widl_ros.diff
reactos/tools/widl/write_msft.c

index d69bf80..47f4465 100644 (file)
@@ -140,7 +140,7 @@ Index: write_msft.c
      retval = TYPE_E_IOERROR;
  
 -    fd = creat(typelib->typelib->filename, 0666);
-+    fd = open(typelib->typelib->filename, O_CREAT | O_RDWR | O_BINARY, 0666);
++    fd = open(typelib->typelib->filename, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0666);
      if (fd == -1) return retval;
  
      filepos = sizeof(MSFT_Header) + sizeof(MSFT_SegDir);
index b2a1e05..346bf0e 100644 (file)
@@ -2413,7 +2413,7 @@ static int save_all_changes(msft_typelib_t *typelib)
 
     retval = TYPE_E_IOERROR;
 
-    fd = open(typelib->typelib->filename, O_CREAT | O_RDWR | O_BINARY, 0666);
+    fd = open(typelib->typelib->filename, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0666);
     if (fd == -1) return retval;
 
     filepos = sizeof(MSFT_Header) + sizeof(MSFT_SegDir);