set the corresponding p(ermission)mode of the file when creating,
authorHans Breuer <hans@breuer.org>
Sat, 21 Jul 2001 17:26:01 +0000 (17:26 +0000)
committerHans Breuer <hans@src.gnome.org>
Sat, 21 Jul 2001 17:26:01 +0000 (17:26 +0000)
2001-07-21  Hans Breuer  <hans@breuer.org>

* glib/giowin32.c (g_io_channel_new_file) : set the
corresponding p(ermission)mode of the file when creating,
otherwise a wronly file couldn't be overwritten (at least
not on Win9x).

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/giowin32.c

index ecc5c9c..a353a6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index ecc5c9c..a353a6b 100644 (file)
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index ecc5c9c..a353a6b 100644 (file)
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index ecc5c9c..a353a6b 100644 (file)
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index ecc5c9c..a353a6b 100644 (file)
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index ecc5c9c..a353a6b 100644 (file)
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index ecc5c9c..a353a6b 100644 (file)
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index ecc5c9c..a353a6b 100644 (file)
@@ -1,5 +1,12 @@
 2001-07-21  Hans Breuer  <hans@breuer.org>
 
+       * glib/giowin32.c (g_io_channel_new_file) : set the
+       corresponding p(ermission)mode of the file when creating,
+       otherwise a wronly file couldn't be overwritten (at least
+       not on Win9x).
+
+2001-07-21  Hans Breuer  <hans@breuer.org>
+
        * glib/giowin32.c : intial implementation of new API functions.
        Not sure if it behaves as intended ...
 
index 3db8b7a..18cd1b1 100644 (file)
@@ -1075,7 +1075,7 @@ g_io_channel_new_file (const gchar  *filename,
                        const gchar  *mode,
                        GError      **error)
 {
-  int fid, flags;
+  int fid, flags, pmode;
   GIOChannel *channel;
 
   enum { /* Cheesy hack */
@@ -1125,29 +1125,36 @@ g_io_channel_new_file (const gchar  *filename,
     {
       case MODE_R:
         flags = O_RDONLY;
+        pmode = _S_IREAD;
         break;
       case MODE_W:
         flags = O_WRONLY | O_TRUNC | O_CREAT;
+        pmode = _S_IWRITE;
         break;
       case MODE_A:
         flags = O_WRONLY | O_APPEND | O_CREAT;
+        pmode = _S_IWRITE;
         break;
       case MODE_R | MODE_PLUS:
         flags = O_RDWR;
+        pmode = _S_IREAD | _S_IWRITE;
         break;
       case MODE_W | MODE_PLUS:
         flags = O_RDWR | O_TRUNC | O_CREAT;
+        pmode = _S_IREAD | _S_IWRITE;
         break;
       case MODE_A | MODE_PLUS:
         flags = O_RDWR | O_APPEND | O_CREAT;
+        pmode = _S_IREAD | _S_IWRITE;
         break;
       default:
         g_assert_not_reached ();
         flags = 0;
+        pmode = 0;
     }
 
 
-  fid = open (filename, flags);
+  fid = open (filename, flags, pmode);
   if (fid < 0)
     {
       g_set_error (error, G_FILE_ERROR,