autofs-5.0.8 - simple coverity fixes From: Ian Kent Add a couple of simple corrections reported by Coverity. --- CHANGELOG | 1 + daemon/automount.c | 6 ------ daemon/lookup.c | 3 ++- modules/lookup_hosts.c | 3 ++- modules/lookup_program.c | 3 ++- modules/mount_bind.c | 4 ++-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 66753ad..d7e03c9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -35,6 +35,7 @@ - fix lookup_nss_mount() map lookup. - dont ignore null cache entries on multi mount umount. - fix inconsistent error returns in handle_packet_missing_direct(). +- simple coverity fixes. 17/10/2013 autofs-5.0.8 ======================= diff --git a/daemon/automount.c b/daemon/automount.c index 18fb670..0dd6477 100644 --- a/daemon/automount.c +++ b/daemon/automount.c @@ -1776,12 +1776,6 @@ static void show_build_info(void) #ifdef ENABLE_FORCED_SHUTDOWN printf("ENABLE_FORCED_SHUTDOWN "); count = count + 23; - - if (count > 60) { - printf("\n "); - count = 0; - } - #endif #ifdef ENABLE_IGNORE_BUSY_MOUNTS diff --git a/daemon/lookup.c b/daemon/lookup.c index 7d96155..31479f7 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -945,7 +945,8 @@ static void update_negative_cache(struct autofs_point *ap, struct map_source *so rv = cache_update(map->mc, map, name, NULL, now); if (rv != CHE_FAIL) { me = cache_lookup_distinct(map->mc, name); - me->status = now + ap->negative_timeout; + if (me) + me->status = now + ap->negative_timeout; } cache_unlock(map->mc); } diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c index 60c01ad..ea8f5d6 100644 --- a/modules/lookup_hosts.c +++ b/modules/lookup_hosts.c @@ -161,7 +161,8 @@ static int do_parse_mount(struct autofs_point *ap, struct map_source *source, rv = cache_update(mc, source, name, NULL, now); if (rv != CHE_FAIL) { me = cache_lookup_distinct(mc, name); - me->status = now + ap->negative_timeout; + if (me) + me->status = now + ap->negative_timeout; } cache_unlock(mc); return NSS_STATUS_TRYAGAIN; diff --git a/modules/lookup_program.c b/modules/lookup_program.c index 326561f..6ce94e4 100644 --- a/modules/lookup_program.c +++ b/modules/lookup_program.c @@ -459,7 +459,8 @@ out_free: rv = cache_update(mc, source, name, NULL, now); if (rv != CHE_FAIL) { me = cache_lookup_distinct(mc, name); - me->status = now + ap->negative_timeout; + if (me) + me->status = now + ap->negative_timeout; } cache_unlock(mc); return NSS_STATUS_TRYAGAIN; diff --git a/modules/mount_bind.c b/modules/mount_bind.c index f14adb7..465f09c 100644 --- a/modules/mount_bind.c +++ b/modules/mount_bind.c @@ -214,14 +214,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int MODPREFIX "failed to create symlink %s -> %s", fullpath, what); - if ((ap->flags & MOUNT_FLAG_GHOST) && !status) + if ((ap->flags & MOUNT_FLAG_GHOST) && !status) { if (mkdir_path(fullpath, 0555) && errno != EEXIST) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(ap->logopt, MODPREFIX "mkdir_path %s failed: %s", fullpath, estr); } - else { + } else { if (ap->type == LKP_INDIRECT) rmdir_path(ap, fullpath, ap->dev); }