Module Name: src Committed By: martin Date: Sun Jun 30 10:07:43 UTC 2013
Modified Files: src/lib/libc/gen: getttyent.c Log Message: Rearrange to make lint deal with it (to unbreak the build). Someone please (1) fix lint and then (2) back this out ;-) To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/libc/gen/getttyent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/gen/getttyent.c diff -u src/lib/libc/gen/getttyent.c:1.25 src/lib/libc/gen/getttyent.c:1.26 --- src/lib/libc/gen/getttyent.c:1.25 Sun Jun 30 07:50:54 2013 +++ src/lib/libc/gen/getttyent.c Sun Jun 30 10:07:43 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: getttyent.c,v 1.25 2013/06/30 07:50:54 matt Exp $ */ +/* $NetBSD: getttyent.c,v 1.26 2013/06/30 10:07:43 martin Exp $ */ /* * Copyright (c) 1989, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: getttyent.c,v 1.25 2013/06/30 07:50:54 matt Exp $"); +__RCSID("$NetBSD: getttyent.c,v 1.26 2013/06/30 10:07:43 martin Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -231,15 +231,19 @@ setttyentpath(const char *path) /* * Try <path>.$MACHINE (e.g. etc/ttys.amd64) */ - char machine[_SYS_NMLN]; - const int mib[] = { [0] = CTL_HW, [1] = HW_MACHINE, }; - size_t len = sizeof(machine); - - if (sysctl(mib, __arraycount(mib), machine, &len, NULL, 0) != -1) { - char npath[PATH_MAX]; - (void)snprintf(npath, sizeof(npath), "%s.%s", path, machine); - if ((tf = fopen(npath, "re")) != NULL) - return 1; + { + char machine[_SYS_NMLN]; + const int mib[] = { [0] = CTL_HW, [1] = HW_MACHINE, }; + size_t len = sizeof(machine); + + if (sysctl(mib, (u_int)__arraycount(mib), machine, &len, + NULL, 0) != -1) { + char npath[PATH_MAX]; + (void)snprintf(npath, sizeof(npath), "%s.%s", path, + machine); + if ((tf = fopen(npath, "re")) != NULL) + return 1; + } } if ((tf = fopen(path, "re")) != NULL)