diff options
author | ngie <ngie@FreeBSD.org> | 2015-10-25 07:42:56 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-10-25 07:42:56 +0000 |
commit | 5ed05b2c9b555cf97cf76324a71ee14b23f6366a (patch) | |
tree | 997ee5278f3bc5b7400cdd44870dc0dec469a36b /lib/libc/stdio/fmemopen.c | |
parent | 6cbc0a272572035a0c0c63932c466c648eb0ea5b (diff) | |
download | FreeBSD-src-5ed05b2c9b555cf97cf76324a71ee14b23f6366a.zip FreeBSD-src-5ed05b2c9b555cf97cf76324a71ee14b23f6366a.tar.gz |
Fix compiling with gcc [4.2.1] after r287797 when MK_HESOID == no and
MK_NIS == no by converting `i` back to an int, and instead cast the loop
comparison to `int`
The loop comparison is iterating the len(ns_dtab)-1, because
the last element is the sentinel tuple { NULL, NULL, NULL, }, so when
both HESOID and NIS are off, len(ns_dtab)-1 == 1 - 1 == 0, and the loop
is skipped because the expression is tautologically false
While here, convert `(sizeof(x) / sizeof(x[0]))` to `nitems(x)`
Tested with: clang 3.7.0, gcc 4.2.1, and gcc 4.9.4 [*] with MK_NIS={no,yes}
and by running bash -lc 'id -u && id -g && id'
* gcc 4.9.4 needs another patch in order for the compile to succeed
with -Werror with lib/libc/gen/getgrent.c
Reported by: jhibbits
Diffstat (limited to 'lib/libc/stdio/fmemopen.c')
0 files changed, 0 insertions, 0 deletions