diff options
| author | Eli Zaretskii | 2013-12-30 19:51:28 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-12-30 19:51:28 +0200 |
| commit | 1b7259fce2719182e2b557682e40d02807784d1f (patch) | |
| tree | cd1def24ee0db4b44e5261af4731f0ecea187d14 /src | |
| parent | 634425957a55b272b0e06a617c725766e1ae0ee9 (diff) | |
| download | emacs-1b7259fce2719182e2b557682e40d02807784d1f.tar.gz emacs-1b7259fce2719182e2b557682e40d02807784d1f.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/w32.c | 29 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fd2b6db1165..18d00ef7640 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-12-30 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (sys_umask): New function. (Bug#16299) | ||
| 4 | |||
| 1 | 2013-12-30 Martin Rudalics <rudalics@gmx.at> | 5 | 2013-12-30 Martin Rudalics <rudalics@gmx.at> |
| 2 | 6 | ||
| 3 | * dispnew.c (change_frame_size_1): Take old width of root window | 7 | * dispnew.c (change_frame_size_1): Take old width of root window |
| @@ -5265,6 +5265,35 @@ utime (const char *name, struct utimbuf *times) | |||
| 5265 | return 0; | 5265 | return 0; |
| 5266 | } | 5266 | } |
| 5267 | 5267 | ||
| 5268 | /* Emacs expects us to support the traditional octal form of the mode | ||
| 5269 | bits, which is not what msvcrt.dll wants. */ | ||
| 5270 | |||
| 5271 | #define WRITE_USER 00200 | ||
| 5272 | |||
| 5273 | int | ||
| 5274 | sys_umask (int mode) | ||
| 5275 | { | ||
| 5276 | static int current_mask; | ||
| 5277 | int retval, arg = 0; | ||
| 5278 | |||
| 5279 | /* The only bit we really support is the write bit. Files are | ||
| 5280 | always readable on MS-Windows, and the execute bit does not exist | ||
| 5281 | at all. */ | ||
| 5282 | /* FIXME: if the GROUP and OTHER bits are reset, we should use ACLs | ||
| 5283 | to prevent access by other users on NTFS. */ | ||
| 5284 | if ((mode & WRITE_USER) != 0) | ||
| 5285 | arg |= S_IWRITE; | ||
| 5286 | |||
| 5287 | retval = _umask (arg); | ||
| 5288 | /* Merge into the return value the bits they've set the last time, | ||
| 5289 | which msvcrt.dll ignores and never returns. Emacs insists on its | ||
| 5290 | notion of mask being identical to what we return. */ | ||
| 5291 | retval |= (current_mask & ~WRITE_USER); | ||
| 5292 | current_mask = mode; | ||
| 5293 | |||
| 5294 | return retval; | ||
| 5295 | } | ||
| 5296 | |||
| 5268 | 5297 | ||
| 5269 | /* Symlink-related functions. */ | 5298 | /* Symlink-related functions. */ |
| 5270 | #ifndef SYMBOLIC_LINK_FLAG_DIRECTORY | 5299 | #ifndef SYMBOLIC_LINK_FLAG_DIRECTORY |