summaryrefslogtreecommitdiffstats
path: root/usr.bin/locate
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
committersjg <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
commit65145fa4c81da358fcbc3b650156dab705dfa34e (patch)
tree55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/locate
parent60ff4eb0dff94a04d75d0d52a3957aaaf5f8c693 (diff)
parente6b664c390af88d4a87208bc042ce503da664c3b (diff)
downloadFreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.zip
FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.tar.gz
Merge sync of head
Diffstat (limited to 'usr.bin/locate')
-rw-r--r--usr.bin/locate/locate/util.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index a28690a..3ac69b5 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -235,7 +235,7 @@ getwm(p)
char buf[INTSIZE];
int i;
} u;
- register int i;
+ register int i, hi;
for (i = 0; i < (int)INTSIZE; i++)
u.buf[i] = *p++;
@@ -243,10 +243,11 @@ getwm(p)
i = u.i;
if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
- i = ntohl(i);
- if (i > MAXPATHLEN || i < -(MAXPATHLEN))
+ hi = ntohl(i);
+ if (hi > MAXPATHLEN || hi < -(MAXPATHLEN))
errx(1, "integer out of +-MAXPATHLEN (%d): %u",
- MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
+ MAXPATHLEN, abs(i) < abs(hi) ? i : hi);
+ return(hi);
}
return(i);
}
@@ -263,16 +264,16 @@ int
getwf(fp)
FILE *fp;
{
- register int word;
+ register int word, hword;
word = getw(fp);
if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
- word = ntohl(word);
- if (word > MAXPATHLEN || word < -(MAXPATHLEN))
+ hword = ntohl(word);
+ if (hword > MAXPATHLEN || hword < -(MAXPATHLEN))
errx(1, "integer out of +-MAXPATHLEN (%d): %u",
- MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
- htonl(word));
+ MAXPATHLEN, abs(word) < abs(hword) ? word : hword);
+ return(hword);
}
return(word);
}
OpenPOWER on IntegriCloud