Source-Changes-HG archive

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

[src/trunk]: src/sbin/umount Don't assume that getaddrinfo sets the result po...



details:   https://anonhg.NetBSD.org/src/rev/f4205197e09d
branches:  trunk
changeset: 346107:f4205197e09d
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jun 26 04:01:30 2016 +0000

description:
Don't assume that getaddrinfo sets the result pointer to null when it
fails. (In fact it probably doesn't...)

diffstat:

 sbin/umount/umount.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 3cc2d48de935 -r f4205197e09d sbin/umount/umount.c
--- a/sbin/umount/umount.c      Sun Jun 26 03:59:11 2016 +0000
+++ b/sbin/umount/umount.c      Sun Jun 26 04:01:30 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umount.c,v 1.51 2016/06/26 03:51:28 dholland Exp $     */
+/*     $NetBSD: umount.c,v 1.52 2016/06/26 04:01:30 dholland Exp $     */
 
 /*-
  * Copyright (c) 1980, 1989, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)umount.c   8.8 (Berkeley) 5/8/95";
 #else
-__RCSID("$NetBSD: umount.c,v 1.51 2016/06/26 03:51:28 dholland Exp $");
+__RCSID("$NetBSD: umount.c,v 1.52 2016/06/26 04:01:30 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -148,7 +148,9 @@
 
        if (nfshost != NULL) {
                memset(&hints, 0, sizeof hints);
-               getaddrinfo(nfshost, NULL, &hints, &nfshost_ai);
+               if (getaddrinfo(nfshost, NULL, &hints, &nfshost_ai) != 0) {
+                       nfshost_ai = NULL;
+               }
        }
                
        errs = 0;
@@ -252,7 +254,8 @@
                                memcpy(hostp, name, len);
                                hostp[len] = 0;
                                name += len + 1;
-                               getaddrinfo(hostp, NULL, &hints, &ai);
+                               if (getaddrinfo(hostp, NULL, &hints, &ai) != 0)
+                                       ai = NULL;
                        }
                }
 



Home | Main Index | Thread Index | Old Index