emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 8453423: Avoid wrong value from file-attributes o


From: Andreas Schwab
Subject: [Emacs-diffs] emacs-26 8453423: Avoid wrong value from file-attributes on Linux kernel before 3.6
Date: Wed, 1 Nov 2017 16:45:23 -0400 (EDT)

branch: emacs-26
commit 8453423c7c5e1886a301fb61c4077650f59e670b
Author: Andreas Schwab <address@hidden>
Commit: Andreas Schwab <address@hidden>

    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)
---
 src/dired.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/dired.c b/src/dired.c
index 28d1cff..239b1ac 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -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;



reply via email to

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