Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/mount_nfs Use ai_nfs instead of the uninitialized ai wh...



details:   https://anonhg.NetBSD.org/src/rev/d08fe302df28
branches:  trunk
changeset: 581475:d08fe302df28
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jun 02 01:24:45 2005 +0000

description:
Use ai_nfs instead of the uninitialized ai when determining the NFSMNT_KERB
reverse IP address, and ensure ecode is set as well.
Detected with gcc -Wuninitialized.
(The bug was introduced in mount_nfs.c rev 1.25.  Hi fvdl! :)

diffstat:

 sbin/mount_nfs/getnfsargs.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 46629a800666 -r d08fe302df28 sbin/mount_nfs/getnfsargs.c
--- a/sbin/mount_nfs/getnfsargs.c       Thu Jun 02 01:23:19 2005 +0000
+++ b/sbin/mount_nfs/getnfsargs.c       Thu Jun 02 01:24:45 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnfsargs.c,v 1.1 2005/05/15 21:18:34 dsl Exp $       */
+/*     $NetBSD: getnfsargs.c,v 1.2 2005/06/02 01:24:45 lukem Exp $     */
 
 /*
  * Copyright (c) 1992, 1993, 1994
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)mount_nfs.c        8.11 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: getnfsargs.c,v 1.1 2005/05/15 21:18:34 dsl Exp $");
+__RCSID("$NetBSD: getnfsargs.c,v 1.2 2005/06/02 01:24:45 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -176,8 +176,9 @@
        if (getaddrinfo(hostp, "nfs", &hints, &ai_nfs) == 0) {
                if ((nfsargsp->flags & NFSMNT_KERB)) {
                        hints.ai_flags = 0;
-                       if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host,
-                           sizeof host, serv, sizeof serv, 0) != 0) {
+                       if ((ecode = getnameinfo(ai_nfs->ai_addr,
+                           ai_nfs->ai_addrlen, host, sizeof(host),
+                           serv, sizeof serv, 0)) != 0) {
                                warnx("can't reverse resolve net address for "
                                    "host \"%s\": %s", hostp,
                                    gai_strerror(ecode));



Home | Main Index | Thread Index | Old Index