diff options
author | ache <ache@FreeBSD.org> | 2002-08-31 01:05:39 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2002-08-31 01:05:39 +0000 |
commit | 323528b1371b2754f510313fed5ffdb88554b418 (patch) | |
tree | 1e925c6a77a30435f31ef33f38613574a1f925ba /lib/libc/locale/collate.c | |
parent | 2fec81a60fa27b997736f46fe7e041d0d75a4b4e (diff) | |
download | FreeBSD-src-323528b1371b2754f510313fed5ffdb88554b418.zip FreeBSD-src-323528b1371b2754f510313fed5ffdb88554b418.tar.gz |
Use ntohl() to read cnains number in new format
Diffstat (limited to 'lib/libc/locale/collate.c')
-rw-r--r-- | lib/libc/locale/collate.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c index ca6040e..16c8e47 100644 --- a/lib/libc/locale/collate.c +++ b/lib/libc/locale/collate.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" +#include <arpa/inet.h> #include <rune.h> #include <stdio.h> #include <stdlib.h> @@ -58,6 +59,7 @@ __collate_load_tables(const char *encoding) { FILE *fp; int i, saverr, chains; + uint32_t u32; char strbuf[STR_LEN], buf[PATH_MAX]; void *TMP_substitute_table, *TMP_char_pri_table, *TMP_chain_pri_table; static char collate_encoding[ENCODING_LEN + 1]; @@ -106,13 +108,13 @@ __collate_load_tables(const char *encoding) return (_LDP_ERROR); } if (chains) { - if (fread(strbuf, sizeof(strbuf), 1, fp) != 1) { + if (fread(&u32, sizeof(u32), 1, fp) != 1) { saverr = errno; (void)fclose(fp); errno = saverr; return (_LDP_ERROR); } - if ((chains = atoi(strbuf)) < 1) { + if ((chains = (int)ntohl(u32)) < 1) { (void)fclose(fp); errno = EFTYPE; return (_LDP_ERROR); |