Hello community,

here is the log from the commit of package pagemon for openSUSE:Factory checked 
in at 2020-11-12 22:48:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pagemon (Old)
 and      /work/SRC/openSUSE:Factory/.pagemon.new.24930 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "pagemon"

Thu Nov 12 22:48:01 2020 rev:11 rq:847946 version:0.01.21

Changes:
--------
--- /work/SRC/openSUSE:Factory/pagemon/pagemon.changes  2020-08-24 
15:13:52.062708795 +0200
+++ /work/SRC/openSUSE:Factory/.pagemon.new.24930/pagemon.changes       
2020-11-12 22:49:53.194799115 +0100
@@ -1,0 +2,6 @@
+Sat Nov  7 20:12:04 UTC 2020 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 0.01.21
+  * Zero ws struct to clear static analysis warnings
+
+-------------------------------------------------------------------

Old:
----
  pagemon-0.01.20.tar.xz

New:
----
  pagemon-0.01.21.tar.xz

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

Other differences:
------------------
++++++ pagemon.spec ++++++
--- /var/tmp/diff_new_pack.MgBQie/_old  2020-11-12 22:49:53.658799598 +0100
+++ /var/tmp/diff_new_pack.MgBQie/_new  2020-11-12 22:49:53.662799603 +0100
@@ -2,7 +2,7 @@
 # spec file for package pagemon
 #
 # Copyright (c) 2020 SUSE LLC
-# Copyright (c) 2017, Martin Hauke <mar...@gmx.de>
+# Copyright (c) 2017-2020, Martin Hauke <mar...@gmx.de>
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 
 Name:           pagemon
-Version:        0.01.20
+Version:        0.01.21
 Release:        0
 Summary:        Interactive memory/page monitoring tool
 License:        GPL-2.0-or-later

++++++ pagemon-0.01.20.tar.xz -> pagemon-0.01.21.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pagemon-0.01.20/Makefile new/pagemon-0.01.21/Makefile
--- old/pagemon-0.01.20/Makefile        2020-07-04 22:10:33.000000000 +0200
+++ new/pagemon-0.01.21/Makefile        2020-11-07 19:06:47.000000000 +0100
@@ -18,7 +18,7 @@
 # Author: Colin Ian King <colin.i.k...@gmail.com>
 #
 
-VERSION=0.01.20
+VERSION=0.01.21
 
 CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' -O2 -fPIC
 LDFLAGS += -lncurses
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pagemon-0.01.20/pagemon.c 
new/pagemon-0.01.21/pagemon.c
--- old/pagemon-0.01.20/pagemon.c       2020-07-04 22:10:33.000000000 +0200
+++ new/pagemon-0.01.21/pagemon.c       2020-11-07 19:06:47.000000000 +0100
@@ -320,6 +320,49 @@
        return pid;
 }
 
+/*
+ *  get_proc_self_stat_field()
+ *     find nth field of /proc/$PID/stat data. This works around
+ *     the problem that the comm field can contain spaces and
+ *     multiple ) so sscanf on this field won't work.  The returned
+ *     pointer is the start of the Nth field and it is up to the
+ *     caller to determine the end of the field
+ */
+static const char *get_proc_self_stat_field(const char *buf, const int num)
+{
+       const char *ptr = buf, *comm_end;
+       int n;
+
+       if (num < 1 || !buf || !*buf)
+               return NULL;
+       if (num == 1)
+               return buf;
+       if (num == 2)
+               return strstr(buf, "(");
+
+       comm_end = NULL;
+       for (ptr = buf; *ptr; ptr++) {
+               if (*ptr == ')')
+                       comm_end = ptr;
+       }
+       if (!comm_end)
+               return NULL;
+       comm_end++;
+       n = num - 2;
+
+       ptr = comm_end;
+       while (*ptr) {
+               while (*ptr && *ptr == ' ')
+                       ptr++;
+               n--;
+               if (n <= 0)
+                       break;
+               while (*ptr && *ptr != ' ')
+                       ptr++;
+       }
+
+       return ptr;
+}
 
 /*
  *  read_faults()
@@ -329,8 +372,8 @@
        uint64_t *const minor_flt,
        uint64_t *const major_flt)
 {
-       int count = 0;
-       char buf[4096], *ptr = buf;
+       char buf[4096];
+       const char *ptr;
 
        *minor_flt = 0;
        *major_flt = 0;
@@ -338,21 +381,9 @@
        if (read_buf(g.path_stat, buf, sizeof(buf)) < 0)
                return -1;
 
-       /*
-        * Skipping over fields is less expensive
-        * than lots of sscanf fields being parsed
-        */
-       while (*ptr) {
-               if (*ptr == ' ') {
-                       count++;
-                       if (count == 9)
-                               break;
-               }
-               ptr++;
-       }
-       if (!*ptr)
+       ptr = get_proc_self_stat_field(buf, 10);
+       if (!ptr)
                return -1;
-
        if (sscanf(ptr, "%" SCNu64 " %*u %" SCNu64, minor_flt, major_flt) != 2)
                return -1;
        return 0;
@@ -1216,7 +1247,7 @@
                "/proc/%i/status", g.pid);
        (void)snprintf(g.path_stat, sizeof(g.path_stat),
                "/proc/%i/stat", g.pid);
-       (void)snprintf(g.path_oom, sizeof(g.path_stat),
+       (void)snprintf(g.path_oom, sizeof(g.path_oom),
                "/proc/%i/oom_score", g.pid);
 
        (void)initscr();
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to