Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package powerstat for openSUSE:Factory 
checked in at 2021-08-16 10:11:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/powerstat (Old)
 and      /work/SRC/openSUSE:Factory/.powerstat.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "powerstat"

Mon Aug 16 10:11:26 2021 rev:12 rq:911930 version:0.02.26

Changes:
--------
--- /work/SRC/openSUSE:Factory/powerstat/powerstat.changes      2021-03-03 
18:36:06.275424052 +0100
+++ /work/SRC/openSUSE:Factory/.powerstat.new.1899/powerstat.changes    
2021-08-16 10:17:33.878660618 +0200
@@ -1,0 +2,8 @@
+Mon Jun 28 12:31:56 UTC 2021 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 0.02.26
+  * Clean up some Coverity static analysis pedantic warnings
+  * Use strlcpy instead of strncpy for safe string handling
+  * Fix recv error when resources are low
+
+-------------------------------------------------------------------

Old:
----
  powerstat-0.02.25.tar.gz

New:
----
  powerstat-0.02.26.tar.gz

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

Other differences:
------------------
++++++ powerstat.spec ++++++
--- /var/tmp/diff_new_pack.VcxjQD/_old  2021-08-16 10:17:34.262660156 +0200
+++ /var/tmp/diff_new_pack.VcxjQD/_new  2021-08-16 10:17:34.266660152 +0200
@@ -18,7 +18,7 @@
 
 
 Name:           powerstat
-Version:        0.02.25
+Version:        0.02.26
 Release:        0
 Summary:        Laptop power measuring tool
 License:        GPL-2.0-only

++++++ powerstat-0.02.25.tar.gz -> powerstat-0.02.26.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/powerstat-0.02.25/Makefile 
new/powerstat-0.02.26/Makefile
--- old/powerstat-0.02.25/Makefile      2021-02-19 13:19:36.000000000 +0100
+++ new/powerstat-0.02.26/Makefile      2021-06-24 18:45:58.000000000 +0200
@@ -16,7 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
 #
 
-VERSION=0.02.25
+VERSION=0.02.26
 
 CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"'
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/powerstat-0.02.25/powerstat.c 
new/powerstat-0.02.26/powerstat.c
--- old/powerstat-0.02.25/powerstat.c   2021-02-19 13:19:36.000000000 +0100
+++ new/powerstat-0.02.26/powerstat.c   2021-06-24 18:45:58.000000000 +0200
@@ -333,6 +333,36 @@
 };
 
 /*
+ *  strlcpy()
+ *     BSD strlcpy
+ */
+static size_t strlcpy(char *dst, const char *src, size_t len)
+{
+        char *d = dst;
+        const char *s = src;
+        size_t n = len;
+
+        if (n) {
+                while (--n) {
+                        char c = *s++;
+
+                        *d++ = c;
+                        if (c == '\0')
+                                break;
+                }
+        }
+
+        if (!n) {
+                if (len)
+                        *d = '\0';
+                while (*s)
+                        s++;
+        }
+
+        return (s - src - 1);
+}
+
+/*
  *   set_prioity
  *     set high priority to try and get netlink activity
  *     before short lived processes die
@@ -759,7 +789,7 @@
 
 static void stats_cpu_freq_read(stats_t *const stats)
 {
-       struct dirent **cpu_list;
+       struct dirent **cpu_list = NULL;
        int i, n_cpus, n = 0;
        double total_freq = 0;
 
@@ -1779,7 +1809,7 @@
                        break;
                }
                names = tmp;
-               (void)strncpy(names + len, new_name, new_len + 1);
+               (void)strlcpy(names + len, new_name, new_len + 1);
                len += new_len;
        }
 
@@ -2129,7 +2159,7 @@
                free(s);
                return NULL;
        }
-       (void)strncpy(s->name_short, name, len + 1);
+       (void)strlcpy(s->name_short, name, len + 1);
        s->name_short[len] = '\0';
        s->hash_next = cpu_states[h];
        cpu_states[h] = s;
@@ -2172,10 +2202,10 @@
        (void)memset(buffer, 0, sizeof(buffer));
        if ((fp = fopen(path, "r")) != NULL) {
                if (fscanf(fp, "%63s", buffer) != 1)
-                       (void)strncpy(buffer, "unknown", sizeof(buffer) - 1);
+                       (void)strlcpy(buffer, "unknown", sizeof(buffer));
                (void)fclose(fp);
        } else {
-               (void)strncpy(buffer, state, sizeof(buffer) - 1);
+               (void)strlcpy(buffer, state, sizeof(buffer));
        }
        if ((ci->cpu_state = cpu_state_get(buffer)) == NULL) {
                free(ci->state);
@@ -2249,7 +2279,7 @@
  */
 static void cpu_states_update(void)
 {
-       struct dirent **cpu_list;
+       struct dirent **cpu_list = NULL;
        int i, n_cpus;
        uint32_t max_cpu_id = 0;
 
@@ -2262,7 +2292,7 @@
                    isdigit(name[3])) {
                        int j, n_states;
                        char path[PATH_MAX];
-                       struct dirent **states_list;
+                       struct dirent **states_list = NULL;
                        uint32_t cpu_id = atoi(name + 3);
 
                        if (max_cpu_id < cpu_id)
@@ -2413,7 +2443,7 @@
        }
 
        if (n < 1) {
-               (void)strncpy(cmdline, "<unknown>", size);
+               (void)strlcpy(cmdline, "<unknown>", size);
                n = 9;
        }
 
@@ -2574,6 +2604,7 @@
                return -1;
        }
 
+       (void)memset(&s1, 0, sizeof(s1));
        if (stats_read(&s1) < 0) {
                free(stats);
                return -1;
@@ -2704,7 +2735,10 @@
                                return 0;
                        }
                        if (len == -1) {
-                               if (errno == EINTR) {
+                               if ((errno == EINTR) ||
+                                   (errno == ENOBUFS) ||
+                                   (errno == ENOMEM)) {
+                                       /* Retry */
                                        continue;
                                } else {
                                        (void)fprintf(stderr,"recv failed: 
errno=%d (%s).\n",

Reply via email to