Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
util-linux
util-linux-libmount-cifs-is_mounted.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-libmount-cifs-is_mounted.patch of Package util-linux
From 76d4fba2e47808264f5c4c883127b0d275e31949 Mon Sep 17 00:00:00 2001 From: Aurelien Aptel <aaptel@suse.com> Date: Thu, 1 Sep 2016 13:57:42 +0200 Subject: [PATCH] libmount: fix mount -a for cifs when mounting a cifs share, the src is actually an UNC path which can in in several forms: simple: //host/share, //host/share/ including subpath: //host/share/sub/path to check if the cifs fs is mounted we have to extract the subpath and compare *that* to the root. Signed-off-by: Aurelien Aptel <aaptel@suse.com> --- libmount/src/tab.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) Index: util-linux-2.25/libmount/src/tab.c =================================================================== --- util-linux-2.25.orig/libmount/src/tab.c +++ util-linux-2.25/libmount/src/tab.c @@ -1392,6 +1392,20 @@ err: } #endif /* HAVE_BTRFS_SUPPORT */ +static const char *get_cifs_unc_subdir_path (const char *unc) +{ + /* + * 1 or more slash: %*[/] + * 1 or more non-slash: %*[^/] + * number of byte read: %n + */ + int share_end = 0; + int r = sscanf(unc, "%*[/]%*[^/]%*[/]%*[^/]%n", &share_end); + if (r == EOF || share_end == 0) + return NULL; + return unc + share_end; +} + /* * tb: /proc/self/mountinfo * fs: filesystem @@ -1629,9 +1643,16 @@ int mnt_table_is_fs_mounted(struct libmn } if (root) { - const char *r = mnt_fs_get_root(fs); - if (!r || strcmp(r, root) != 0) - continue; + if (strcmp(mnt_fs_get_fstype(fs), "cifs") == 0) { + const char *unc_subdir = get_cifs_unc_subdir_path(src); + const char *path_on_fs = mnt_fs_get_root(fs); + if (!unc_subdir || !path_on_fs || !streq_paths(unc_subdir, path_on_fs)) + continue; + } else { + const char *r = mnt_fs_get_root(fs); + if (!r || strcmp(r, root) != 0) + continue; + } } /*
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor