From 6ab4e37d350f3208e677f7e06516a02c24f25d72 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 13 Oct 2017 07:45:00 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/psmisc?expand=0&rev=96 --- ...to-be-able-to-use-the-mount-identity.patch | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch b/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch index b380dd3..979b504 100644 --- a/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch +++ b/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch @@ -1,4 +1,4 @@ -From 02b6674c8b57db637093a1f753075a601c460c80 Mon Sep 17 00:00:00 2001 +From 8fa126fdf938cef959bd64d8da2aff2e7bc5dd37 Mon Sep 17 00:00:00 2001 From: Werner Fink Date: Thu, 29 Jun 2017 15:18:28 +0200 Subject: [PATCH] Use mountinfo to be able to use the mount identity @@ -14,11 +14,11 @@ get the real mount ID for each file Signed-off-by: Werner Fink --- configure.ac | 18 +- - src/fuser.c | 530 +++++++++++++++++++++++++++---------- + src/fuser.c | 528 +++++++++++++++++++++++++++---------- src/fuser.h | 19 +- testsuite/Makefile.am | 3 +- testsuite/killall.test/killall.exp | 4 + - 5 files changed, 426 insertions(+), 148 deletions(-) + 5 files changed, 424 insertions(+), 148 deletions(-) diff --git configure.ac configure.ac index 176a2fc..d8d3366 100644 @@ -64,7 +64,7 @@ index 176a2fc..d8d3366 100644 dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git src/fuser.c src/fuser.c -index 31ef30c..d5d72a9 100644 +index 31ef30c..d7fd729 100644 --- src/fuser.c +++ src/fuser.c @@ -32,6 +32,10 @@ @@ -588,7 +588,7 @@ index 31ef30c..d5d72a9 100644 { list_t *ptr, *tmp; -@@ -2005,72 +2095,234 @@ static void clear_mntinfo(void) +@@ -2005,72 +2095,232 @@ static void clear_mntinfo(void) } } @@ -661,12 +661,13 @@ index 31ef30c..d5d72a9 100644 +static int +get_fdinfo(const pid_t pid, const char *fd, struct fdinfo *info) +{ ++ int ret = 0; ++ char pathname[256]; +#if defined(HAS_FDINFO) + const static char delimiters[] = ": \t\n"; -+ char pathname[256]; + char line[BUFSIZ]; + FILE *fp; -+ int ret = 0, mnt_id = 0, flags = 0; ++ int mnt_id = 0, flags = 0; + + snprintf(pathname, 256, "/proc/%d/fdinfo/%s", pid, fd); + if ((fp = fopen(pathname, "r")) == NULL) @@ -690,15 +691,12 @@ index 31ef30c..d5d72a9 100644 + mnt_id++; + ret++; + } -+ + } + fclose(fp); +out: +#endif + if (!flags || !mnt_id) { -+ char pathname[256]; + struct stat lst; -+ int ret = 0; + + snprintf(pathname, 256, "/proc/%d/fd/%s", pid, fd); + if (!flags && ret == lstat(pathname, &lst) == 0) { @@ -867,7 +865,7 @@ index 31ef30c..d5d72a9 100644 /* * Determine device of links below /proc/ */ -@@ -2078,8 +2330,7 @@ static int mntstat(const char *path, struct stat *buf) +@@ -2078,8 +2328,7 @@ static int mntstat(const char *path, struct stat *buf) { char name[PATH_MAX + 1]; const char *use; @@ -877,7 +875,7 @@ index 31ef30c..d5d72a9 100644 if ((use = realpath(path, name)) == NULL || *use != '/') { -@@ -2091,27 +2342,26 @@ static int mntstat(const char *path, struct stat *buf) +@@ -2091,27 +2340,26 @@ static int mntstat(const char *path, struct stat *buf) errno = 0; return stat(path, buf); }