Changeset 17943 in niluje


Ignore:
Timestamp:
Nov 16, 2020, 10:54:31 PM (12 days ago)
Author:
NiLuJe
Message:

Kindle Hacks:

  • X-TC:
    • Fallback to statfs if fstatfs fails on an O_PATH fd There's a rather large window of Linux versions where O_PATH exists, but isn't supported by fstatfs… Kobo Mk. 6 happen to fall squarely in that window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Configs/trunk/Kindle/Misc/util-linux-2.36-o_path-open-flag-compat.diff

    r17622 r17943  
    11diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
    2 index df9a2ebf5..62ec7680d 100644
     2index df9a2ebf5..acf163d72 100644
    33--- a/libmount/src/context_umount.c
    44+++ b/libmount/src/context_umount.c
     
    1111 
    1212                DBG(CXT, ul_debugobj(cxt, "  trying fstatfs()"));
    13 @@ -297,6 +298,11 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
     13@@ -293,10 +294,21 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
     14                /* O_PATH avoids triggering automount points. */
     15                fd = open(tgt, O_PATH);
     16                if (fd >= 0) {
     17-                       if (fstatfs(fd, &vfs) == 0)
     18+                       if (fstatfs(fd, &vfs) == 0) {
    1419                                type = mnt_statfs_get_fstype(&vfs);
     20+                       } else {
     21+                               /* fstatfs only supports O_PATH fds since Linux 3.12... */
     22+                               DBG(CXT, ul_debugobj(cxt, "  trying statfs()"));
     23+                               if (statfs(tgt, &vfs) == 0)
     24+                                       type = mnt_statfs_get_fstype(&vfs);
     25+                       }
    1526                        close(fd);
    1627                }
Note: See TracChangeset for help on using the changeset viewer.