Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/gen More error checking.



details:   https://anonhg.NetBSD.org/src/rev/b1082533ccca
branches:  trunk
changeset: 571115:b1082533ccca
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 11 04:03:23 2004 +0000

description:
More error checking.

diffstat:

 lib/libc/gen/devname.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r c625e8639ae6 -r b1082533ccca lib/libc/gen/devname.c
--- a/lib/libc/gen/devname.c    Thu Nov 11 03:32:05 2004 +0000
+++ b/lib/libc/gen/devname.c    Thu Nov 11 04:03:23 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devname.c,v 1.12 2004/11/11 03:22:30 christos Exp $    */
+/*     $NetBSD: devname.c,v 1.13 2004/11/11 04:03:23 christos Exp $    */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
 #if 0
 static char sccsid[] = "@(#)devname.c  8.2 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: devname.c,v 1.12 2004/11/11 03:22:30 christos Exp $");
+__RCSID("$NetBSD: devname.c,v 1.13 2004/11/11 04:03:23 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -112,11 +112,14 @@
 static mode_t
 getptsmajor(void)
 {
-       DIR *dirp = opendir(_PATH_DEV_PTS);
+       DIR *dirp;
        struct dirent *dp;
        struct stat st;
        char buf[MAXPATHLEN];
 
+       if ((dirp = opendir(_PATH_DEV_PTS)) == NULL)
+               return (mode_t)~0;
+
        while ((dp = readdir(dirp)) != NULL) {
                if (dp->d_name[0] == '.')
                        continue;



Home | Main Index | Thread Index | Old Index