diff options
| author | Andreas Schwab | 2017-11-01 15:26:21 +0100 |
|---|---|---|
| committer | Andreas Schwab | 2017-11-01 21:44:49 +0100 |
| commit | 8453423c7c5e1886a301fb61c4077650f59e670b (patch) | |
| tree | 56ff7258819099ba68381be2efd365bf33763683 /src | |
| parent | 70621e25713b8158cc386a70247f63106df3712c (diff) | |
| download | emacs-8453423c7c5e1886a301fb61c4077650f59e670b.tar.gz emacs-8453423c7c5e1886a301fb61c4077650f59e670b.zip | |
Avoid wrong value from file-attributes on Linux kernel before 3.6
* dired.c (file_attributes): Handle unsupported fstat on O_PATH
descriptors. (bug#29070)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dired.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dired.c b/src/dired.c index 28d1cffb44c..239b1acd1fb 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -953,7 +953,14 @@ file_attributes (int fd, char const *name, | |||
| 953 | { | 953 | { |
| 954 | record_unwind_protect_int (close_file_unwind, namefd); | 954 | record_unwind_protect_int (close_file_unwind, namefd); |
| 955 | if (fstat (namefd, &s) != 0) | 955 | if (fstat (namefd, &s) != 0) |
| 956 | err = errno; | 956 | { |
| 957 | err = errno; | ||
| 958 | /* The Linux kernel before version 3.6 does not support | ||
| 959 | fstat on O_PATH file descriptors. Handle this error like | ||
| 960 | missing support for O_PATH. */ | ||
| 961 | if (err == EBADF) | ||
| 962 | err = EINVAL; | ||
| 963 | } | ||
| 957 | else | 964 | else |
| 958 | { | 965 | { |
| 959 | err = 0; | 966 | err = 0; |