summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7cf9e06)
raw | patch | inline | side by side (parent: 7cf9e06)
author | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Sun, 1 Apr 2007 11:17:16 +0000 (11:17 +0000) | ||
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Sun, 1 Apr 2007 11:17:16 +0000 (11:17 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1668 f882894a-f735-0410-b71e-b25c423dba1c
lib/utils_disk.c | patch | blob | history |
diff --git a/lib/utils_disk.c b/lib/utils_disk.c
index cfd6a97968edb716f26f1e69ecc29e91ea826e08..96f5a306438e579abaf6277b496a6b04c06e943a 100644 (file)
--- a/lib/utils_disk.c
+++ b/lib/utils_disk.c
@@ -98,25 +98,26 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list
size_t best_match_len = 0;
struct mount_entry *best_match = NULL;
+ /* set best match if path name exactly matches a mounted device name */
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 &&
- (len == 1 || strncmp (me->me_mountdir, d->name, len) == 0)))
- || (exact == TRUE && strcmp(me->me_mountdir, d->name)==0))
- {
+ if (strcmp(me->me_devname, d->name)==0)
best_match = me;
- best_match_len = len;
- } else {
- len = strlen (me->me_devname);
- if ((exact == FALSE && (best_match_len <= len && len <= name_len &&
- (len == 1 || strncmp (me->me_devname, d->name, len) == 0)))
- || (exact == TRUE && strcmp(me->me_devname, d->name)==0))
+ }
+
+ /* 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) {
+ 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 (best_match) {
d->best_match = best_match;
} else {