diff options
author | Bruce Beare <bruce.j.beare@intel.com> | 2011-10-21 10:16:11 +0800 |
---|---|---|
committer | Bruce Beare <bruce.j.beare@intel.com> | 2011-12-07 09:47:20 -0800 |
commit | 7d03c9cbcedb1dc7e3a8210ac0001120558ec6df (patch) | |
tree | b2ee12be2fee00fae82b89608563a2112a3b9062 /libc/unistd/pathconf.c | |
parent | 177ba8cb42ed6d232e7c8bcad5e6ee21fc51a0e8 (diff) | |
download | bionic-7d03c9cbcedb1dc7e3a8210ac0001120558ec6df.zip bionic-7d03c9cbcedb1dc7e3a8210ac0001120558ec6df.tar.gz bionic-7d03c9cbcedb1dc7e3a8210ac0001120558ec6df.tar.bz2 |
pathconf: dead loop in bionic function __2_symlinks
Fix dead loops in file ./bionic/libc/unistd/pathconf.c
Change-Id: I7a1e6bcd9879c96bacfd376b88a1f899793295c8
Author: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Diffstat (limited to 'libc/unistd/pathconf.c')
-rw-r--r-- | libc/unistd/pathconf.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libc/unistd/pathconf.c b/libc/unistd/pathconf.c index 032f918..26b580f 100644 --- a/libc/unistd/pathconf.c +++ b/libc/unistd/pathconf.c @@ -70,13 +70,12 @@ __filesizebits( struct statfs* s ) }; int nn = 0; - for (;;) { - if ( known64[nn] == EOL_MAGIC ) - return 32; - - if ( known64[nn] == s->f_type ) + for (; known64[nn] != EOL_MAGIC; ++nn) { + if (known64[nn] == s->f_type) { return 64; + } } + return 32; } @@ -99,12 +98,10 @@ __link_max( struct statfs* s ) }; int nn = 0; - for (;;) { - if ( knownMax[nn].type == EOL_MAGIC ) - return LINK_MAX; - - if ( knownMax[nn].type == s->f_type ) + for (; knownMax[nn].type != EOL_MAGIC; ++nn) { + if (knownMax[nn].type == s->f_type) { return knownMax[nn].max; + } } return LINK_MAX; } @@ -121,12 +118,12 @@ __2_symlinks( struct statfs* s ) }; int nn = 0; - for (;;) { - if (knownNoSymlinks[nn] == 0) - return 1; - if (knownNoSymlinks[nn] == s->f_type) + for (; knownNoSymlinks[nn] != EOL_MAGIC; ++nn) { + if (knownNoSymlinks[nn] == s->f_type) { return 0; + } } + return 1; } static long |