From 6c78f0b5ea82a4bea71ae2024f27d3916175a7a2 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 12 Mar 2023 14:16:35 +0100 Subject: Fixes for -Wunused * lib/utils_base.c * plugins/check_curl.c * plugins-root/check_dhcp.c Removed a line which theoretically can not do anything, but there was comment which indicated something else. Still trying this though. --- lib/utils_base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/utils_base.c b/lib/utils_base.c index eb1823bb..c458cf61 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c @@ -24,7 +24,7 @@ * *****************************************************************************/ -#include "common.h" +#include "../plugins/common.h" #include #include "utils_base.h" #include @@ -319,18 +319,18 @@ char *np_extract_value(const char *varlist, const char *name, char sep) { while (1) { /* Strip any leading space */ - for (varlist; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++); if (strncmp(name, varlist, strlen(name)) == 0) { varlist += strlen(name); /* strip trailing spaces */ - for (varlist; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++); if (varlist[0] == '=') { /* We matched the key, go past the = sign */ varlist++; /* strip leading spaces */ - for (varlist; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++); if (tmp = index(varlist, sep)) { /* Value is delimited by a comma */ -- cgit v1.2.3-74-g34f1 From 0dd11100aa92bab172293ec9615a8a56b0e35ee6 Mon Sep 17 00:00:00 2001 From: Stefan Taferner Date: Wed, 10 May 2023 19:28:05 +0200 Subject: avoid mounting when searching for matching mount points --- lib/utils_disk.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/utils_disk.c b/lib/utils_disk.c index 468769b1..582d3ea1 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c @@ -147,24 +147,25 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list /* set best match if path name exactly matches a mounted device name */ for (me = mount_list; me; me = me->me_next) { - if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) < 0) - continue; /* skip if permissions do not suffice for accessing device */ - if (strcmp(me->me_devname, d->name)==0) - best_match = me; + if (strcmp(me->me_devname, d->name)==0) { + if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) >= 0) { + best_match = me; + } + } } /* set best match by directory name if no match was found by devname */ if (! best_match) { for (me = mount_list; me; me = me->me_next) { - if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) < 0) - continue; /* skip if permissions do not suffice for accessing device */ size_t len = strlen (me->me_mountdir); if ((exact == FALSE && (best_match_len <= len && len <= name_len && (len == 1 || strncmp (me->me_mountdir, d->name, len) == 0))) || (exact == TRUE && strcmp(me->me_mountdir, d->name)==0)) { - best_match = me; - best_match_len = len; + if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) >= 0) { + best_match = me; + best_match_len = len; + } } } } -- cgit v1.2.3-74-g34f1