]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid wrong value from file-attributes on Linux kernel before 3.6
authorAndreas Schwab <schwab@linux-m68k.org>
Wed, 1 Nov 2017 14:26:21 +0000 (15:26 +0100)
committerAndreas Schwab <schwab@linux-m68k.org>
Wed, 1 Nov 2017 20:44:49 +0000 (21:44 +0100)
* dired.c (file_attributes): Handle unsupported fstat on O_PATH
descriptors.  (bug#29070)

src/dired.c

index 28d1cffb44c4eeda5cddaeddbb12b74b6764f365..239b1acd1fb532b5c88cd1d7e74e8095e77c7d0f 100644 (file)
@@ -953,7 +953,14 @@ file_attributes (int fd, char const *name,
     {
       record_unwind_protect_int (close_file_unwind, namefd);
       if (fstat (namefd, &s) != 0)
-       err = errno;
+       {
+         err = errno;
+         /* The Linux kernel before version 3.6 does not support
+            fstat on O_PATH file descriptors.  Handle this error like
+            missing support for O_PATH.  */
+         if (err == EBADF)
+           err = EINVAL;
+       }
       else
        {
          err = 0;