emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115810: Fix bug #16299 with assertion violation in


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r115810: Fix bug #16299 with assertion violation in set-default-file-modes on Windows.
Date: Mon, 30 Dec 2013 17:52:52 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115810
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16299
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2013-12-30 19:51:28 +0200
message:
  Fix bug #16299 with assertion violation in set-default-file-modes on Windows.
  
   src/w32.c (sys_umask): New function.
  
   nt/inc/ms-w32.h (umask) [emacs]: Redirect to sys_umask.
modified:
  nt/ChangeLog                   changelog-20091113204419-o5vbwnq5f7feedwu-1545
  nt/inc/ms-w32.h                msw32.h-20091113204419-o5vbwnq5f7feedwu-807
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32.c                      w32.c-20091113204419-o5vbwnq5f7feedwu-808
=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2013-12-23 18:32:58 +0000
+++ b/nt/ChangeLog      2013-12-30 17:51:28 +0000
@@ -1,3 +1,7 @@
+2013-12-30  Eli Zaretskii  <address@hidden>
+
+       * inc/ms-w32.h (umask) [emacs]: Redirect to sys_umask.  (Bug#16299)
+
 2013-12-23  Eli Zaretskii  <address@hidden>
 
        * README.W32:

=== modified file 'nt/inc/ms-w32.h'
--- a/nt/inc/ms-w32.h   2013-12-07 17:21:57 +0000
+++ b/nt/inc/ms-w32.h   2013-12-30 17:51:28 +0000
@@ -235,6 +235,9 @@
 extern int sys_unlink (const char *);
 #undef write
 #define write   sys_write
+#undef umask
+#define umask   sys_umask
+extern int sys_umask (int);
 
 /* Subprocess calls that are emulated.  */
 #define spawnve sys_spawnve
@@ -276,7 +279,6 @@
 #define lseek     _lseek
 #define popen     _popen
 #define pclose    _pclose
-#define umask    _umask
 #define strdup    _strdup
 #define strupr    _strupr
 #define strnicmp  _strnicmp

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-12-30 09:14:29 +0000
+++ b/src/ChangeLog     2013-12-30 17:51:28 +0000
@@ -1,3 +1,7 @@
+2013-12-30  Eli Zaretskii  <address@hidden>
+
+       * w32.c (sys_umask): New function.  (Bug#16299)
+
 2013-12-30  Martin Rudalics  <address@hidden>
 
        * dispnew.c (change_frame_size_1): Take old width of root window

=== modified file 'src/w32.c'
--- a/src/w32.c 2013-12-18 03:21:48 +0000
+++ b/src/w32.c 2013-12-30 17:51:28 +0000
@@ -5265,6 +5265,35 @@
   return 0;
 }
 
+/* Emacs expects us to support the traditional octal form of the mode
+   bits, which is not what msvcrt.dll wants.  */
+
+#define WRITE_USER 00200
+
+int
+sys_umask (int mode)
+{
+  static int current_mask;
+  int retval, arg = 0;
+
+  /* The only bit we really support is the write bit.  Files are
+     always readable on MS-Windows, and the execute bit does not exist
+     at all.  */
+  /* FIXME: if the GROUP and OTHER bits are reset, we should use ACLs
+     to prevent access by other users on NTFS.  */
+  if ((mode & WRITE_USER) != 0)
+    arg |= S_IWRITE;
+
+  retval = _umask (arg);
+  /* Merge into the return value the bits they've set the last time,
+     which msvcrt.dll ignores and never returns.  Emacs insists on its
+     notion of mask being identical to what we return.  */
+  retval |= (current_mask & ~WRITE_USER);
+  current_mask = mode;
+
+  return retval;
+}
+
 
 /* Symlink-related functions.  */
 #ifndef SYMBOLIC_LINK_FLAG_DIRECTORY


reply via email to

[Prev in Thread] Current Thread [Next in Thread]