Hello community,

here is the log from the commit of package wavemon for openSUSE:Factory checked 
in at 2018-02-22 15:00:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/wavemon (Old)
 and      /work/SRC/openSUSE:Factory/.wavemon.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "wavemon"

Thu Feb 22 15:00:46 2018 rev:24 rq:577960 version:0.8.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/wavemon/wavemon.changes  2017-05-24 
16:51:46.382681108 +0200
+++ /work/SRC/openSUSE:Factory/.wavemon.new/wavemon.changes     2018-02-22 
15:00:47.937559064 +0100
@@ -1,0 +2,19 @@
+Sun Feb 18 16:16:37 UTC 2018 - mar...@gmx.de
+
+- Remove patch:
+  * reproducible.patch (fixed upstream)
+- Update to version 0.8.2
+  * Fixes
+    - Info Screen:
+      + do not warn about missing data if driver returns 0
+        signal value (#44),
+      + present retry/drop rate also as percentage (#38),
+      + remove outdated WEP encryption key information (#8);
+    - Scan Screen:
+      + revise and improve access to thread data (#42).
+  * Miscellaneous
+    - build process now sorts input files for reproducible builds
+    - miscellaneous fixes, such as typos, email information
+    - code clean-up
+
+-------------------------------------------------------------------

Old:
----
  reproducible.patch
  wavemon-0.8.1.tar.gz

New:
----
  wavemon-0.8.2.tar.gz

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

Other differences:
------------------
++++++ wavemon.spec ++++++
--- /var/tmp/diff_new_pack.hHe2HF/_old  2018-02-22 15:00:49.065518484 +0100
+++ /var/tmp/diff_new_pack.hHe2HF/_new  2018-02-22 15:00:49.065518484 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package wavemon
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,15 +17,13 @@
 
 
 Name:           wavemon
-Version:        0.8.1
+Version:        0.8.2
 Release:        0
 Summary:        An ncurses monitoring application for wireless network devices
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Productivity/Networking/Diagnostic
 Url:            https://github.com/uoaerg/wavemon
 Source:         
https://github.com/uoaerg/wavemon/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM bmwiedemann https://github.com/uoaerg/wavemon/pull/35
-Patch0:         reproducible.patch
 BuildRequires:  libcap-devel
 BuildRequires:  ncurses-devel
 BuildRequires:  pkgconfig
@@ -42,7 +40,6 @@
 
 %prep
 %setup -q
-%patch0 -p1
 
 %build
 if [ -n "$SOURCE_DATE_EPOCH" ] ; then

++++++ wavemon-0.8.1.tar.gz -> wavemon-0.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/Makefile.in 
new/wavemon-0.8.2/Makefile.in
--- old/wavemon-0.8.1/Makefile.in       2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/Makefile.in       2018-02-18 01:23:56.000000000 +0100
@@ -20,7 +20,7 @@
 
 MAIN   = @PACKAGE_NAME@.c
 HEADERS        = $(wildcard *.h)
-PURESRC        = $(filter-out $(MAIN),$(wildcard *.c))
+PURESRC        = $(filter-out $(MAIN),$(sort $(wildcard *.c)))
 OBJS   = $(PURESRC:.c=.o)
 DOCS   = README.md NEWS THANKS AUTHORS COPYING ChangeLog
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/about_scr.c 
new/wavemon-0.8.2/about_scr.c
--- old/wavemon-0.8.1/about_scr.c       2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/about_scr.c       2018-02-18 01:23:56.000000000 +0100
@@ -29,9 +29,6 @@
        "original by jan morgenstern <j...@jm-music.de>",
        "distributed under the GNU general public license v3",
        "",
-       "please send suggestions and bug reports to ",
-       PACKAGE_BUGREPORT,
-       "",
        PACKAGE_URL
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/configure new/wavemon-0.8.2/configure
--- old/wavemon-0.8.1/configure 2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/configure 2018-02-18 01:23:56.000000000 +0100
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for wavemon 0.8.0.
+# Generated by GNU Autoconf 2.69 for wavemon 0.8.2.
 #
-# Report bugs to <ger...@erg.abdn.ac.uk>.
+# Report bugs to <https://github.com/uoaerg/wavemon>.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -267,10 +267,10 @@
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
     $as_echo "$0: Please tell bug-autoc...@gnu.org and
-$0: ger...@erg.abdn.ac.uk about your system, including any
-$0: error possibly output before this message. Then install
-$0: a modern shell, or manually run the script under such a
-$0: shell if you do have one."
+$0: https://github.com/uoaerg/wavemon about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
   fi
   exit 1
 fi
@@ -580,9 +580,9 @@
 # Identity of this package.
 PACKAGE_NAME='wavemon'
 PACKAGE_TARNAME='wavemon-current'
-PACKAGE_VERSION='0.8.0'
-PACKAGE_STRING='wavemon 0.8.0'
-PACKAGE_BUGREPORT='ger...@erg.abdn.ac.uk'
+PACKAGE_VERSION='0.8.2'
+PACKAGE_STRING='wavemon 0.8.2'
+PACKAGE_BUGREPORT='https://github.com/uoaerg/wavemon'
 PACKAGE_URL='https://github.com/uoaerg/wavemon'
 
 # Factoring default headers for most tests.
@@ -1249,7 +1249,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures wavemon 0.8.0 to adapt to many kinds of systems.
+\`configure' configures wavemon 0.8.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1314,7 +1314,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of wavemon 0.8.0:";;
+     short | recursive ) echo "Configuration of wavemon 0.8.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1343,7 +1343,7 @@
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <ger...@erg.abdn.ac.uk>.
+Report bugs to <https://github.com/uoaerg/wavemon>.
 wavemon home page: <https://github.com/uoaerg/wavemon>.
 _ACEOF
 ac_status=$?
@@ -1407,7 +1407,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-wavemon configure 0.8.0
+wavemon configure 0.8.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1608,9 +1608,9 @@
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" 
>&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the 
compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ------------------------------------ ##
-## Report this to ger...@erg.abdn.ac.uk ##
-## ------------------------------------ ##"
+( $as_echo "## ------------------------------------------------ ##
+## Report this to https://github.com/uoaerg/wavemon ##
+## ------------------------------------------------ ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
@@ -1830,7 +1830,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by wavemon $as_me 0.8.0, which was
+It was created by wavemon $as_me 0.8.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4955,7 +4955,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by wavemon $as_me 0.8.0, which was
+This file was extended by wavemon $as_me 0.8.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5002,14 +5002,14 @@
 Configuration files:
 $config_files
 
-Report bugs to <ger...@erg.abdn.ac.uk>.
+Report bugs to <https://github.com/uoaerg/wavemon>.
 wavemon home page: <https://github.com/uoaerg/wavemon>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-wavemon config.status 0.8.0
+wavemon config.status 0.8.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/configure.ac 
new/wavemon-0.8.2/configure.ac
--- old/wavemon-0.8.1/configure.ac      2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/configure.ac      2018-02-18 01:23:56.000000000 +0100
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.64)
-AC_INIT([wavemon], [0.8.0], [ger...@erg.abdn.ac.uk], [wavemon-current],
+AC_INIT([wavemon], [0.8.2], [https://github.com/uoaerg/wavemon], 
[wavemon-current],
        [https://github.com/uoaerg/wavemon])
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/info_scr.c new/wavemon-0.8.2/info_scr.c
--- old/wavemon-0.8.1/info_scr.c        2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/info_scr.c        2018-02-18 01:23:56.000000000 +0100
@@ -53,6 +53,7 @@
 
 void sampling_init(void)
 {
+       pthread_mutex_init(&linkstat.mutex, NULL);
        linkstat.run = true;
        pthread_create(&sampling_thread, NULL, sampling_loop, NULL);
 }
@@ -61,6 +62,7 @@
 {
        linkstat.run = false;
        pthread_join(sampling_thread, NULL);
+       pthread_mutex_destroy(&linkstat.mutex);
 }
 
 static void display_levels(void)
@@ -78,7 +80,6 @@
        bool noise_data_valid;
        int sig_qual = -1, sig_qual_max, sig_level;
 
-
        noise_data_valid = iw_nl80211_have_survey_data(&linkstat.data);
        sig_level = linkstat.data.signal_avg ?: linkstat.data.signal;
 
@@ -103,12 +104,6 @@
                sig_qual_max = 70;
        }
 
-       if (sig_qual == -1 && !sig_level && !noise_data_valid) {
-               wattron(w_levels, A_BOLD);
-               waddstr_center(w_levels, (WH_LEVEL + 1)/2, "NO INTERFACE DATA");
-               goto done_levels;
-       }
-
        line = 1;
 
        /* Noise data is rare. Use the space for spreading out. */
@@ -173,7 +168,6 @@
                waddstr_b(w_levels, tmp);
        }
 
-done_levels:
        wrefresh(w_levels);
 }
 
@@ -211,7 +205,8 @@
 
        if (linkstat.data.rx_drop_misc) {
                waddstr(w_stats, ", drop: ");
-               sprintf(tmp, "%'llu", (unsigned long 
long)linkstat.data.rx_drop_misc);
+               sprintf(tmp, "%'llu (%.1f%%)", (unsigned long 
long)linkstat.data.rx_drop_misc,
+                               (1e2 * 
linkstat.data.rx_drop_misc)/linkstat.data.rx_packets);
                waddstr_b(w_stats, tmp);
        }
 
@@ -237,7 +232,8 @@
 
        if (linkstat.data.tx_retries) {
                waddstr(w_stats, ", retries: ");
-               sprintf(tmp, "%'u", linkstat.data.tx_retries);
+               sprintf(tmp, "%'u (%.1f%%)", linkstat.data.tx_retries,
+                       (1e2 * 
linkstat.data.tx_retries)/linkstat.data.tx_packets);
                waddstr_b(w_stats, tmp);
        }
 
@@ -257,10 +253,9 @@
        struct iw_nl80211_ifstat ifs;
        struct iw_nl80211_reg ir;
        char tmp[0x100];
-       int i;
 
        iw_getinf_range(conf_ifname(), &range);
-       dyn_info_get(&info, conf_ifname(), &range);
+       dyn_info_get(&info, conf_ifname());
        iw_nl80211_getifstat(&ifs);
        iw_nl80211_getreg(&ir);
 
@@ -530,63 +525,11 @@
        }
        wclrtoborder(w_info);
 
+       /* FIXME: re-enable encryption information (issue #8)
        wmove(w_info, 7, 1);
        waddstr(w_info, "encryption: ");
-       if (info.keys) {
-               int cnt = dyn_info_active_keys(&info);
-
-               if (cnt == 0) {
-                       waddstr_b(w_info, "off (no key set)");
-               } else if (info.active_key) {
-                       i = info.active_key - 1;
-                       waddstr_b(w_info, curtail(format_key(info.keys + i),
-                                         "..", MAXXLEN/2));
-
-                       if (info.keys[i].flags & IW_ENCODE_RESTRICTED)
-                               waddstr(w_info, ", restricted");
-                       if (info.keys[i].flags & IW_ENCODE_OPEN)
-                               waddstr(w_info, ", open");
-
-                       /* First key = default */
-                       if (cnt > 1 || info.active_key != 1) {
-                               sprintf(tmp, " [%d]", info.active_key);
-                               waddstr_b(w_info, tmp);
-                       }
-                       if (cnt > 1) {
-                               sprintf(tmp, " (%d other key%s)", cnt - 1,
-                                       cnt == 2 ? "" : "s");
-                               waddstr(w_info, tmp);
-                       }
-               } else  if (dyn_info_wep_keys(&info) == cnt) {
-                       waddstr_b(w_info, "off ");
-                       sprintf(tmp, "(%d disabled WEP key%s)", cnt,
-                               cnt == 1 ? "" : "s");
-                       waddstr(w_info, tmp);
-               } else {
-                       uint8_t j = 0, k = 0;
-
-                       do  if (info.keys[j].size &&
-                               !(info.keys[j].flags & IW_ENCODE_DISABLED))
-                                       info.keys[k++].size = info.keys[j].size;
-                       while (k < cnt && ++j < info.nkeys);
-
-                       if (cnt == 1)
-                               j = sprintf(tmp, "1 key (index #%u), ", j + 1);
-                       else
-                               j = sprintf(tmp, "%d keys with ", k);
-                       for (i = 0; i < k; i++)
-                               j += sprintf(tmp + j, "%s%d",   i ? "/" : "",
-                                            info.keys[i].size * 8);
-                       sprintf(tmp + j, " bits");
-                       waddstr_b(w_info, tmp);
-               }
-       } else if (has_net_admin_capability()) {
-               waddstr(w_info, "no information available");
-       } else {
-               waddstr(w_info, "n/a (requires CAP_NET_ADMIN permissions)");
-       }
+       */
 
-       dyn_info_cleanup(&info);
        wclrtoborder(w_info);
        wrefresh(w_info);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/iw_if.c new/wavemon-0.8.2/iw_if.c
--- old/wavemon-0.8.1/iw_if.c   2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/iw_if.c   2018-02-18 01:23:56.000000000 +0100
@@ -154,11 +154,10 @@
  * @ifname: interface name
  * @if:            range information to use (number of encryption keys)
  */
-void dyn_info_get(struct iw_dyn_info *info,
-                 const char *ifname, struct iw_range *ir)
+void dyn_info_get(struct iw_dyn_info *info, const char *ifname)
 {
        struct iwreq iwr;
-       int i, skfd = socket(AF_INET, SOCK_DGRAM, 0);
+       int skfd = socket(AF_INET, SOCK_DGRAM, 0);
 
        if (skfd < 0)
                err_sys("%s: can not open socket", __func__);
@@ -230,43 +229,6 @@
                info->mode     = iwr.u.mode;
        }
 
-       info->nkeys = ir->max_encoding_tokens;
-       if (info->nkeys) {
-               info->keys = calloc(info->nkeys, sizeof(*info->keys));
-               if (info->keys == NULL)
-                       err_sys("malloc(key array)");
-
-               /* Get index of default key first */
-               iwr.u.data.pointer = info->keys[0].key;
-               iwr.u.data.length  = sizeof(info->keys[0].key);
-               iwr.u.data.flags   = 0;
-               if (ioctl(skfd, SIOCGIWENCODE, &iwr) < 0) {
-                       free(info->keys);
-                       info->keys  = NULL;
-                       info->nkeys = 0;
-               } else {
-                       info->active_key = iwr.u.data.flags & IW_ENCODE_INDEX;
-               }
-       }
-       /* If successful, populate the key array */
-       for (i = 0; i < info->nkeys; i++) {
-               iwr.u.data.pointer = info->keys[i].key;
-               iwr.u.data.length  = sizeof(info->keys->key);
-               iwr.u.data.flags   = i + 1;     /* counts 1..n instead of 
0..n-1 */
-               if (ioctl(skfd, SIOCGIWENCODE, &iwr) < 0) {
-                       free(info->keys);
-                       info->nkeys = 0;
-                       break;
-               }
-               info->keys[i].size  = iwr.u.data.length;
-               info->keys[i].flags = iwr.u.data.flags;
-
-               /* Validate whether the current key is indeed active */
-               if (i + 1 == info->active_key && (info->keys[i].size == 0 ||
-                   (info->keys[i].flags & IW_ENCODE_DISABLED)))
-                       info->active_key = 0;
-       }
-
        if (ioctl(skfd, SIOCGIWAP, &iwr) >= 0) {
                info->cap_ap = 1;
                memcpy(&info->ap_addr, &iwr.u.ap_addr, sizeof(struct sockaddr));
@@ -274,13 +236,6 @@
        close(skfd);
 }
 
-void dyn_info_cleanup(struct iw_dyn_info *info)
-{
-       if (info)
-               free(info->keys);
-}
-
-
 /*
  * Request range information for a given wireless interface.
  * @ifname: name of the wireless argument
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/iw_if.h new/wavemon-0.8.2/iw_if.h
--- old/wavemon-0.8.1/iw_if.h   2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/iw_if.h   2018-02-18 01:23:56.000000000 +0100
@@ -148,37 +148,9 @@
        float           freq;
        int32_t         sens;
        unsigned long   bitrate;
-
-       struct iw_key   *keys;
-       uint8_t         nkeys;
-       uint8_t         active_key;
 };
 
-/* Return the number of encryption keys marked 'active' in @info */
-static inline uint8_t dyn_info_active_keys(struct iw_dyn_info *info)
-{
-       int i, num_active = 0;
-
-       for (i = 0; i < info->nkeys; i++)
-               num_active += info->keys[i].size &&
-                             !(info->keys[i].flags & IW_ENCODE_DISABLED);
-       return num_active;
-}
-
-/* Return the number of 40-bit/104-bit keys in @info */
-static inline uint8_t dyn_info_wep_keys(struct iw_dyn_info *info)
-{
-       int i, num_wep = 0;
-
-       for (i = 0; i < info->nkeys; i++)
-               if (!(info->keys[i].flags & IW_ENCODE_DISABLED))
-                       num_wep += info->keys[i].size == 5 ||
-                                  info->keys[i].size == 13;
-       return num_wep;
-}
-extern void dyn_info_get(struct iw_dyn_info *info,
-                        const char *ifname, struct iw_range *ir);
-extern void dyn_info_cleanup(struct iw_dyn_info *info);
+extern void dyn_info_get(struct iw_dyn_info *info, const char *ifname);
 
 
 /*
@@ -278,8 +250,8 @@
        pthread_mutex_t   mutex;
 };
 
-extern void scan_result_init(struct scan_result *sr);
-extern void scan_result_fini(struct scan_result *sr);
+extern void init_scan_list(struct scan_result *sr);
+extern void free_scan_list(struct scan_entry *head);
 extern void *do_scan(void *sr_ptr);
 
 /*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/iw_nl80211.c 
new/wavemon-0.8.2/iw_nl80211.c
--- old/wavemon-0.8.1/iw_nl80211.c      2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/iw_nl80211.c      2018-02-18 01:23:56.000000000 +0100
@@ -128,7 +128,7 @@
                rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]);
        if (rate > 0)
                pos += snprintf(pos, buflen - (pos - buf),
-                               "%d.%d MBit/s", rate / 10, rate % 10);
+                               "%d.%d Mbit/s", rate / 10, rate % 10);
 
        if (rinfo[NL80211_RATE_INFO_MCS])
                pos += snprintf(pos, buflen - (pos - buf),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/iw_scan.c new/wavemon-0.8.2/iw_scan.c
--- old/wavemon-0.8.1/iw_scan.c 2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/iw_scan.c 2018-02-18 01:23:56.000000000 +0100
@@ -105,7 +105,7 @@
  * Returns true if scan results are available, false if scan was aborted.
  * Taken from iw:event.c:__do_listen_events
  */
-static bool wait_for_scan_events(struct scan_result *sr)
+static bool wait_for_scan_events(void)
 {
        static const uint32_t cmds[] = {
                NL80211_CMD_NEW_SCAN_RESULTS,
@@ -293,7 +293,8 @@
        *headp = head;
 }
 
-static void free_scan_list(struct scan_entry *head)
+/** De-allocate list. Use after all threads are terminated. */
+void free_scan_list(struct scan_entry *head)
 {
        if (head) {
                free_scan_list(head->next);
@@ -301,9 +302,9 @@
        }
 }
 
-static void clear_scan_list(struct scan_result *sr)
+/** Initialize scan results. Requires lock to be taken. */
+void init_scan_list(struct scan_result *sr)
 {
-       pthread_mutex_lock(&sr->mutex);
        free_scan_list(sr->head);
        free(sr->channel_stats);
        sr->head          = NULL;
@@ -311,7 +312,7 @@
        sr->msg[0]        = '\0';
        sr->max_essid_len = MAX_ESSID_LEN;
        memset(&(sr->num), 0, sizeof(sr->num));
-       pthread_mutex_unlock(&sr->mutex);
+       sr->mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
 }
 
 /*
@@ -366,28 +367,6 @@
        sr->num.ch_stats = n < MAX_CH_STATS ? n : MAX_CH_STATS;
 }
 
-/*
- *     Scan results.
- */
-void scan_result_init(struct scan_result *sr)
-{
-       pthread_mutexattr_t ma;
-
-       memset(sr, 0, sizeof(*sr));
-       pthread_mutexattr_init(&ma);
-       if (pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST) < 0)
-               err_sys("Failed to set the mutex robust attribute");
-       pthread_mutex_init(&sr->mutex, &ma);
-}
-
-void scan_result_fini(struct scan_result *sr)
-{
-       /* FIXME: this may have a bug on resource de-allocation, if the main 
thread still holds the lock */
-       free_scan_list(sr->head);
-       free(sr->channel_stats);
-       pthread_mutex_destroy(&sr->mutex);
-}
-
 /** The actual scan thread. */
 void *do_scan(void *sr_ptr)
 {
@@ -402,15 +381,21 @@
 
        pthread_detach(pthread_self());
        do {
-               clear_scan_list(sr);
-
                ret = iw_nl80211_scan_trigger();
+
+               pthread_mutex_lock(&sr->mutex);
+               init_scan_list(sr);
                switch(-ret) {
                case 0:
                case EBUSY:
                        /* Trigger returns -EBUSY if a scan request is pending 
or ready. */
-                       if (!wait_for_scan_events(sr)) {
+                       pthread_mutex_unlock(&sr->mutex);
+
+                       /* Do not hold the lock while awaiting results. */
+                       if (!wait_for_scan_events()) {
+                               pthread_mutex_lock(&sr->mutex);
                                snprintf(sr->msg, sizeof(sr->msg), "Waiting for 
scan data...");
+                               pthread_mutex_unlock(&sr->mutex);
                        } else {
                                pthread_mutex_lock(&sr->mutex);
                                ret = iw_nl80211_get_scan_data(sr);
@@ -426,8 +411,8 @@
                        break;
                case EPERM:
                        if (!has_net_admin_capability())
-                               snprintf(sr->msg, sizeof(sr->msg),
-                                        "This screen requires CAP_NET_ADMIN 
permissions");
+                               snprintf(sr->msg, sizeof(sr->msg), "This screen 
requires CAP_NET_ADMIN permissions");
+                       pthread_mutex_unlock(&sr->mutex);
                        return NULL;
                case EFAULT:
                        /* EFAULT can occur after a window resizing event: 
temporary, fall through. */
@@ -435,18 +420,21 @@
                case EAGAIN:
                        /* Temporary errors. */
                        snprintf(sr->msg, sizeof(sr->msg), "Waiting for device 
to become ready ...");
+                       pthread_mutex_unlock(&sr->mutex);
                        break;
                case ENETDOWN:
                        if (!if_is_up(conf_ifname())) {
                                snprintf(sr->msg, sizeof(sr->msg), "Interface 
%s is down - setting it up ...", conf_ifname());
+                               pthread_mutex_unlock(&sr->mutex);
+
                                if (if_set_up(conf_ifname()) < 0)
                                        err_sys("Can not bring up interface 
'%s'", conf_ifname());
                                break;
                        }
                        /* fall through */
                default:
-                       snprintf(sr->msg, sizeof(sr->msg),
-                                "Scan trigger failed on %s: %s", 
conf_ifname(), strerror(-ret));
+                       snprintf(sr->msg, sizeof(sr->msg), "Scan trigger failed 
on %s: %s", conf_ifname(), strerror(-ret));
+                       pthread_mutex_unlock(&sr->mutex);
                }
        } while (usleep(conf.stat_iv * 1000) == 0);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/scan_scr.c new/wavemon-0.8.2/scan_scr.c
--- old/wavemon-0.8.1/scan_scr.c        2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/scan_scr.c        2018-02-18 01:23:56.000000000 +0100
@@ -203,7 +203,7 @@
        mvwaddstr(w_aplst, START_LINE, 1, "Waiting for scan data ...");
        wrefresh(w_aplst);
 
-       scan_result_init(&sr);
+       init_scan_list(&sr);
        pthread_create(&scan_thread, NULL, do_scan, &sr);
 }
 
@@ -251,6 +251,8 @@
 void scr_aplst_fini(void)
 {
        pthread_cancel(scan_thread);
-       scan_result_fini(&sr);
+       free_scan_list(sr.head);
+       free(sr.channel_stats);
+
        delwin(w_aplst);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wavemon-0.8.1/wavemon.h new/wavemon-0.8.2/wavemon.h
--- old/wavemon-0.8.1/wavemon.h 2016-12-15 20:21:36.000000000 +0100
+++ new/wavemon-0.8.2/wavemon.h 2018-02-18 01:23:56.000000000 +0100
@@ -51,7 +51,7 @@
        WH_IFACE    = 2,        /* 'Interface' area at the top */
        WH_LEVEL    = 9,        /* Level meters */
        WH_STATS    = 3,        /* WiFi statistics area */
-       WH_INFO_MIN = 8,        /* WiFi information area */
+       WH_INFO_MIN = 7,        /* WiFi information area */
        WH_NET_MIN  = 3,        /* Network interface information area */
        WH_NET_MAX  = 5,        /* Network interface information area */
        WH_MENU     = 1         /* Menu bar at the bottom */


Reply via email to