Page MenuHomeFreeBSD

D23109.id66560.diff
No OneTemporary

D23109.id66560.diff

Index: lib/libc/locale/collate.c
===================================================================
--- lib/libc/locale/collate.c
+++ lib/libc/locale/collate.c
@@ -105,11 +105,17 @@
int
__collate_load_tables(const char *encoding)
{
+ struct xlocale_collate *table = &__xlocale_global_collate;
- return (__collate_load_tables_l(encoding, &__xlocale_global_collate));
+ if (table->map && (table->maplen > 0)) {
+ (void) munmap(table->map, table->maplen);
+ table->map = NULL;
+ table->maplen = 0;
+ }
+ return (__collate_load_tables_l(encoding, table));
}
-int
+static int
__collate_load_tables_l(const char *encoding, struct xlocale_collate *table)
{
int i, chains, z;
@@ -147,7 +153,7 @@
}
map = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
(void) _close(fd);
- if ((TMP = map) == NULL) {
+ if ((TMP = map) == MAP_FAILED) {
return (_LDP_ERROR);
}
@@ -181,6 +187,8 @@
return (_LDP_ERROR);
}
+ table->map = map;
+ table->maplen = sbuf.st_size;
table->info = info;
table->char_pri_table = (void *)TMP;
TMP += sizeof (collate_char_t) * (UCHAR_MAX + 1);
Index: lib/libc/locale/rune.c
===================================================================
--- lib/libc/locale/rune.c
+++ lib/libc/locale/rune.c
@@ -94,7 +94,7 @@
fdata = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
(void) _close(fd);
- if (fdata == NULL) {
+ if (fdata == MAP_FAILED) {
errno = EINVAL;
return (NULL);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 25, 7:22 AM (18 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35466759
Default Alt Text
D23109.id66560.diff (1 KB)

Event Timeline