X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=lib%2Futils_disk.c;h=3d20f4d4125c075e9dbc5762d79758564a4985d8;hb=b48c2bdd59783197c93cde531e6e8b9747c0a88f;hp=e22d66807176cb7a37e11aa7f0074599ea556c74;hpb=39c3f58cdc82297b305326be076aa3b50ecba73d;p=nagiosplug.git diff --git a/lib/utils_disk.c b/lib/utils_disk.c index e22d668..3d20f4d 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c @@ -5,8 +5,6 @@ * License: GPL * Copyright (c) 1999-2007 Nagios Plugins Development Team * -* Last Modified: $Date$ -* * Description: * * This file contains utilities for check_disk. These are tested by libtap @@ -25,7 +23,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * -* $Id$ * *****************************************************************************/ @@ -77,22 +74,21 @@ np_add_parameter(struct parameter_list **list, const char *name) struct parameter_list * np_del_parameter(struct parameter_list *item, struct parameter_list *prev) { - struct parameter_list *next; - if (item->name_next) - next = item->name_next; - else - next = NULL; + struct parameter_list *next; - - free(item); - if (prev) - prev->name_next = next; + if (item->name_next) + next = item->name_next; + else + next = NULL; - return next; + free(item); + if (prev) + prev->name_next = next; + return next; } - + /* returns a pointer to the struct found in the list */ struct parameter_list * np_find_parameter(struct parameter_list *list, const char *name) @@ -102,7 +98,7 @@ np_find_parameter(struct parameter_list *list, const char *name) if (! strcmp(temp_list->name, name)) return temp_list; } - + return NULL; } @@ -127,7 +123,7 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list if (! best_match) { for (me = mount_list; me; me = me->me_next) { size_t len = strlen (me->me_mountdir); - if ((exact == FALSE && (best_match_len <= len && len <= name_len && + 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)) { @@ -176,7 +172,7 @@ np_seen_name(struct name_list *list, const char *name) } int -np_regex_match_mount_entry (struct mount_entry* me, regex_t* re) +np_regex_match_mount_entry (struct mount_entry* me, regex_t* re) { if (regexec(re, me->me_devname, (size_t) 0, NULL, 0) == 0 || regexec(re, me->me_mountdir, (size_t) 0, NULL, 0) == 0 ) {