Hello community,

here is the log from the commit of package psmisc for openSUSE:Factory checked 
in at 2017-10-23 16:38:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/psmisc (Old)
 and      /work/SRC/openSUSE:Factory/.psmisc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "psmisc"

Mon Oct 23 16:38:24 2017 rev:66 rq:534218 version:23.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/psmisc/psmisc.changes    2017-09-21 
12:32:19.112598558 +0200
+++ /work/SRC/openSUSE:Factory/.psmisc.new/psmisc.changes       2017-10-23 
16:38:27.934316599 +0200
@@ -1,0 +2,6 @@
+Fri Oct 13 07:10:39 UTC 2017 - [email protected]
+
+- Modify patch 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
+  to run even on older kernels missing mnt_id tag in fdinfo 
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch ++++++
--- /var/tmp/diff_new_pack.tq6aXv/_old  2017-10-23 16:38:28.378295821 +0200
+++ /var/tmp/diff_new_pack.tq6aXv/_new  2017-10-23 16:38:28.378295821 +0200
@@ -1,4 +1,4 @@
-From 60bbf03a076374e20aa62e1f3297be170403fcb7 Mon Sep 17 00:00:00 2001
+From c0652a4686d259dabdb3e96498d8dda7cdc9da03 Mon Sep 17 00:00:00 2001
 From: Werner Fink <[email protected]>
 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 @@
 Signed-off-by: Werner Fink <[email protected]>
 ---
  configure.ac                       |  18 +-
- src/fuser.c                        | 525 +++++++++++++++++++++++++++----------
+ src/fuser.c                        | 528 +++++++++++++++++++++++++++----------
  src/fuser.h                        |  19 +-
  testsuite/Makefile.am              |   3 +-
  testsuite/killall.test/killall.exp |   4 +
- 5 files changed, 421 insertions(+), 148 deletions(-)
+ 5 files changed, 424 insertions(+), 148 deletions(-)
 
 diff --git configure.ac configure.ac
 index 176a2fc..d8d3366 100644
@@ -64,7 +64,7 @@
  dnl Checks for typedefs, structures, and compiler characteristics.
  AC_C_CONST
 diff --git src/fuser.c src/fuser.c
-index 31ef30c..4ef7cfd 100644
+index 31ef30c..1c7c496 100644
 --- src/fuser.c
 +++ src/fuser.c
 @@ -32,6 +32,10 @@
@@ -588,7 +588,7 @@
  {
        list_t *ptr, *tmp;
  
-@@ -2005,72 +2095,229 @@ static void clear_mntinfo(void)
+@@ -2005,72 +2095,232 @@ static void clear_mntinfo(void)
        }
  }
  
@@ -661,12 +661,13 @@
 +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;
++      int mnt_id = 0, flags = 0;
 +
 +      snprintf(pathname, 256, "/proc/%d/fdinfo/%s", pid, fd);
 +      if ((fp = fopen(pathname, "r")) == NULL)
@@ -682,37 +683,39 @@
 +                      continue;
 +              if (strcmp(fp, "flags")  == 0 && (ul = strtoul(vp, &ep, 0)) != 
ULONG_MAX && ep && *ep == 0) {
 +                      info->flags = (mode_t)ul;
++                      flags++;
 +                      ret++;
 +              }
 +              if (strcmp(fp, "mnt_id") == 0 && (ul = strtoul(vp, &ep, 0)) != 
ULONG_MAX && ep && *ep == 0) {
 +                      info->mnt_id = (int)ul;
++                      mnt_id++;
 +                      ret++;
 +              }
-+
 +      }
 +      fclose(fp);
 +out:
-+#else
-+      char pathname[256], *realname;
-+      struct stat lst;
-+      int ret = 0;
-+
-+      snprintf(pathname, 256, "/proc/%d/fd/%s", pid, fd);
-+      if (lstat(pathname, &lst) == 0) {
-+              if (lst.st_mode & S_IWUSR)
-+                      info->flags |= O_WRONLY;
-+              ret++;
-+      }
++#endif
++      if (!flags || !mnt_id) {
++              struct stat lst;
 +
-+      realname = expandpath(pathname);
-+      if (realname) {
-+              mntinfo_t *mountinfo;
-+              if (find_mountpoint(realname, &mountinfo) == 0) {
-+                      info->mnt_id = mountinfo->id;
++              snprintf(pathname, 256, "/proc/%d/fd/%s", pid, fd);
++              if (!flags && lstat(pathname, &lst) == 0) {
++                      if (lst.st_mode & S_IWUSR)
++                              info->flags |= O_WRONLY;
 +                      ret++;
 +              }
++
++              if (!mnt_id) {
++                      char *realname = expandpath(pathname);
++                      if (realname) {
++                              mntinfo_t *mountinfo;
++                              if (find_mountpoint(realname, &mountinfo) == 0) 
{
++                                      info->mnt_id = mountinfo->id;
++                                      ret++;
++                              }
++                      }
++              }
 +      }
-+#endif
 +      return ret == 2 ? 0 : -1;
 +}
 +
@@ -742,14 +745,14 @@
 +      int mnt_id = get_mountid(path);
 +#endif
 +      int ret = -1;
++
++      *mountinfo = NULL;
  
 -      /* Sort mount points accordingly to the reverse mount order */
 -      initial(&sort);
 -      for (mid = 1; mid <= max; mid++) {
 -              list_t *ptr, *tmp;
 -              list_for_each_safe(ptr, tmp, &mntinfo) {
-+      *mountinfo = NULL;
-+
 +#if defined(HAS_NAME_TO_HANDLE_AT)
 +      if (mnt_id >= 0) {
 +              list_t *ptr;
@@ -831,12 +834,12 @@
 -                      if (mid != mnt->parid)
 +
 +                      if (nlen != mnt->nlen)
-+                              continue;
-+
-+                      if (strcmp(use, mnt->mpoint))
                                continue;
 -                      move_head(ptr, &sort);
 +
++                      if (strcmp(use, mnt->mpoint))
++                              continue;
++
 +                      ret = 0;
 +                      errno = 0;
 +                      *mountinfo = mnt;
@@ -862,7 +865,7 @@
  /*
   * Determine device of links below /proc/
   */
-@@ -2078,8 +2325,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;
@@ -872,7 +875,7 @@
  
        if ((use = realpath(path, name)) == NULL || *use != '/')
        {
-@@ -2091,27 +2337,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);
        }


Reply via email to