Blob Blame History Raw
From ed936e1909a314febfdb9574bd10cc2d46d2b3e3 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Fri, 19 Feb 2016 10:41:49 +0100
Subject: [PATCH] mountlist: recognize autofs-mounted remote file systems, too

Originally reported at: https://bugzilla.redhat.com/1309247
* lib/mountlist.c (ME_REMOTE): Return true if a file system is named
"-hosts" because it is used by autofs to mount remote file systems.

Upstream-commit: 781788eeb5d4d0b816698e8629300cd90a7379bd
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 lib/mountlist.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/mountlist.c b/lib/mountlist.c
index b839cd1..17779f6 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -212,13 +212,15 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
 
 #ifndef ME_REMOTE
 /* A file system is "remote" if its Fs_name contains a ':'
-   or if (it is of type (smbfs or cifs) and its Fs_name starts with '//').  */
+   or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
+   or Fs_name is equal to "-hosts" (used by autofs to mount remote fs).  */
 # define ME_REMOTE(Fs_name, Fs_type)            \
     (strchr (Fs_name, ':') != NULL              \
      || ((Fs_name)[0] == '/'                    \
          && (Fs_name)[1] == '/'                 \
          && (strcmp (Fs_type, "smbfs") == 0     \
-             || strcmp (Fs_type, "cifs") == 0)))
+             || strcmp (Fs_type, "cifs") == 0)) \
+     || (strcmp("-hosts", Fs_name) == 0))
 #endif
 
 #if MOUNTED_GETMNTINFO
-- 
2.5.0