summaryrefslogtreecommitdiffstats
path: root/lib/libc/nls
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2000-08-30 11:44:44 +0000
committerache <ache@FreeBSD.org>2000-08-30 11:44:44 +0000
commit85d6a9927230533e7a82c336c7185e66e0e2301e (patch)
tree0c06dd307184eb02fd72a327284d2b21144d0ba9 /lib/libc/nls
parent9e4e8601b97b0eac9ccaa4eeef050062465c6ab2 (diff)
downloadFreeBSD-src-85d6a9927230533e7a82c336c7185e66e0e2301e.zip
FreeBSD-src-85d6a9927230533e7a82c336c7185e66e0e2301e.tar.gz
catgets: detect if fd becomes invalid after exec and return default response
cosmetique, use NULL for pointers comparison
Diffstat (limited to 'lib/libc/nls')
-rw-r--r--lib/libc/nls/msgcat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c
index ee97058..cb61b14 100644
--- a/lib/libc/nls/msgcat.c
+++ b/lib/libc/nls/msgcat.c
@@ -194,7 +194,7 @@ int setId;
MCSetT *set;
long lo, hi, cur, dir;
- if (!cat || setId <= 0) return(NULL);
+ if (cat == NULL || setId <= 0) return(NULL);
lo = 0;
if (setId - 1 < cat->numSets) {
@@ -220,8 +220,8 @@ int setId;
if (hi - lo == 1) cur += dir;
else cur += ((hi - lo) / 2) * dir;
}
- if (set->invalid)
- (void) loadSet(cat, set);
+ if (set->invalid && loadSet(cat, set) <= 0)
+ return(NULL);
return(set);
}
@@ -233,7 +233,7 @@ int msgId;
MCMsgT *msg;
long lo, hi, cur, dir;
- if (!set || set->invalid || msgId <= 0) return(NULL);
+ if (set == NULL || set->invalid || msgId <= 0) return(NULL);
lo = 0;
if (msgId - 1 < set->numMsgs) {
@@ -326,7 +326,7 @@ __const char *catpath;
off_t nextSet;
cat = (MCCatT *) malloc(sizeof(MCCatT));
- if (!cat) return(NLERR);
+ if (cat == NULL) return(NLERR);
cat->loadType = MCLoadBySet;
if ((cat->fd = _open(catpath, O_RDONLY)) < 0) {
@@ -359,7 +359,7 @@ __const char *catpath;
cat->numSets = header.numSets;
cat->sets = (MCSetT *) malloc(sizeof(MCSetT) * header.numSets);
- if (!cat->sets) NOSPACE();
+ if (cat->sets == NULL) NOSPACE();
nextSet = header.firstSet;
for (i = 0; i < cat->numSets; ++i) {
OpenPOWER on IntegriCloud