aboutsummaryrefslogtreecommitdiff
path: root/lang/cli/files/patch-pal::unix::file::file.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang/cli/files/patch-pal::unix::file::file.c')
-rw-r--r--lang/cli/files/patch-pal::unix::file::file.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/lang/cli/files/patch-pal::unix::file::file.c b/lang/cli/files/patch-pal::unix::file::file.c
index 67013da52e2b..d962c7ad5113 100644
--- a/lang/cli/files/patch-pal::unix::file::file.c
+++ b/lang/cli/files/patch-pal::unix::file::file.c
@@ -1,25 +1,42 @@
$FreeBSD$
---- pal/unix/file/file.c 2002/04/09 22:17:33 1.1
-+++ pal/unix/file/file.c 2002/04/09 22:19:43
-@@ -2822,18 +2822,10 @@
- }
- else
- {
-- /* give write permission to anyone that has read permission */
-+ /* give write permission to owner if it has read permission */
- if ( new_mode & S_IRUSR )
- {
- new_mode |= S_IWUSR;
-- }
-- if ( new_mode & S_IRGRP )
-- {
-- new_mode |= S_IWGRP;
-- }
-- if ( new_mode & S_IROTH )
-- {
-- new_mode |= S_IWOTH;
- }
- }
- TRACE("new mode is 0x%lx\n", new_mode);
+--- pal/unix/file/file.c.orig Fri Mar 22 03:48:20 2002
++++ pal/unix/file/file.c Wed Apr 10 11:52:45 2002
+@@ -37,6 +37,9 @@
+ #include <sys/stat.h>
+ #include <errno.h>
+
++#define chmod( path, mode ) chmod( ( path ), ( mode ) & ~GetUmask() )
++#define fchmod( fd, mode ) fchmod( ( fd ), ( mode ) & ~GetUmask() )
++#define lchmod( path, mode ) lchmod( ( path ), ( mode ) & ~GetUmask() )
+
+ SET_DEFAULT_DEBUG_CHANNEL(FILE);
+
+@@ -44,6 +47,8 @@
+ static int FILECloseStdHandle( HOBJSTRUCT *handle_data);
+ static int FILEDuplicateHandle( HANDLE handle, HOBJSTRUCT *handle_data);
+
++static mode_t GetUmask( void );
++
+ static file *FILENewFileData( void );
+
+ static BOOL FILEAddNewLockedRgn(SHMFILELOCKS* fileLocks,
+@@ -2342,6 +2347,17 @@
+ HMGRUnlockHandle(handle,&file_data->handle_data);
+ }
+
++static mode_t GetUmask( void )
++{
++ mode_t mask;
++
++ /* XXX: Probably need to block signals to avoid race here */
++ mask = umask( 0 );
++ umask( mask );
++ /* XXX: Unblock here */
++
++ return mask;
++}
+
+ /*++
+ Function: