diff options
| author | Eli Zaretskii | 2012-10-05 11:17:17 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-10-05 11:17:17 +0200 |
| commit | 0d9f584b2c2a816670a22948615d7e0a5b93fc10 (patch) | |
| tree | f980325890f384eb4741d047e9796c8f04fc355d /src | |
| parent | 379acb951495d947ff42da6fc79b39f2e5f2f623 (diff) | |
| download | emacs-0d9f584b2c2a816670a22948615d7e0a5b93fc10.tar.gz emacs-0d9f584b2c2a816670a22948615d7e0a5b93fc10.zip | |
Support setting file times of directories on MS-Windows.
src/w32.c (utime): Open the file with FILE_FLAG_BACKUP_SEMANTICS, so
that time stamps of directories could also be changed. Don't
request the too broad GENERIC_WRITE, only the more restrictive
FILE_WRITE_ATTRIBUTES access rights.
src/fileio.c (Fset_file_times): Special-case ignoring errors for
directories only on MSDOS, not on MS-Windows.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/w32.c | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 396240bb7b8..b2502010619 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2012-10-05 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (utime): Open the file with FILE_FLAG_BACKUP_SEMANTICS, so | ||
| 4 | that time stamps of directories could also be changed. Don't | ||
| 5 | request the too broad GENERIC_WRITE, only the more restrictive | ||
| 6 | FILE_WRITE_ATTRIBUTES access rights. | ||
| 7 | |||
| 8 | * fileio.c (Fset_file_times): Special-case ignoring errors for | ||
| 9 | directories only on MSDOS, not on MS-Windows. | ||
| 10 | |||
| 1 | 2012-10-05 Ikumi Keita <ikumi@ikumi.que.jp> (tiny change) | 11 | 2012-10-05 Ikumi Keita <ikumi@ikumi.que.jp> (tiny change) |
| 2 | 12 | ||
| 3 | * minibuf.c (Fcompleting_read): Doc fix. (Bug#12555) | 13 | * minibuf.c (Fcompleting_read): Doc fix. (Bug#12555) |
diff --git a/src/fileio.c b/src/fileio.c index 9ce9e7b8395..b4eda01afcc 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3034,7 +3034,7 @@ Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of | |||
| 3034 | { | 3034 | { |
| 3035 | if (set_file_times (-1, SSDATA (encoded_absname), t, t)) | 3035 | if (set_file_times (-1, SSDATA (encoded_absname), t, t)) |
| 3036 | { | 3036 | { |
| 3037 | #ifdef DOS_NT | 3037 | #ifdef MSDOS |
| 3038 | struct stat st; | 3038 | struct stat st; |
| 3039 | 3039 | ||
| 3040 | /* Setting times on a directory always fails. */ | 3040 | /* Setting times on a directory always fails. */ |
| @@ -3952,8 +3952,9 @@ utime (const char *name, struct utimbuf *times) | |||
| 3952 | } | 3952 | } |
| 3953 | 3953 | ||
| 3954 | /* Need write access to set times. */ | 3954 | /* Need write access to set times. */ |
| 3955 | fh = CreateFile (name, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, | 3955 | fh = CreateFile (name, FILE_WRITE_ATTRIBUTES, |
| 3956 | 0, OPEN_EXISTING, 0, NULL); | 3956 | FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, |
| 3957 | 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); | ||
| 3957 | if (fh != INVALID_HANDLE_VALUE) | 3958 | if (fh != INVALID_HANDLE_VALUE) |
| 3958 | { | 3959 | { |
| 3959 | convert_from_time_t (times->actime, &atime); | 3960 | convert_from_time_t (times->actime, &atime); |