diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-04-24 18:20:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-04-24 18:20:10 +0000 |
commit | c2d5bd5b00cfbb0ef192821f2d724fb6448d59e3 (patch) | |
tree | 61e1ed7ad4b5c220917d91bae2a8aa38a037b4c2 | |
parent | f397be127c20a04c55a0545c0950dcb8acd03eaa (diff) | |
download | glibc-c2d5bd5b00cfbb0ef192821f2d724fb6448d59e3.tar.gz glibc-c2d5bd5b00cfbb0ef192821f2d724fb6448d59e3.tar.xz glibc-c2d5bd5b00cfbb0ef192821f2d724fb6448d59e3.zip |
[BZ #10100]
2009-04-24 Ulrich Drepper <drepper@redhat.com> [BZ #10100] * misc/hsearch_r.c (hsearch_r): Add back ensurance that hval is not zero.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | locale/programs/locarchive.c | 27 | ||||
-rw-r--r-- | misc/hsearch_r.c | 2 |
3 files changed, 20 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog index 70c7e4888a..2ea0108da4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-04-24 Ulrich Drepper <drepper@redhat.com> + + [BZ #10100] + * misc/hsearch_r.c (hsearch_r): Add back ensurance that hval is + not zero. + 2009-04-24 Jakub Jelinek <jakub@redhat.com> * iconvdata/sjis.c (BODY): Don't advance inptr before diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c index 02f89de3a8..66c5d393e2 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -131,14 +131,12 @@ create_archive (const char *archivefname, struct locarhandle *ah) /* To prepare for enlargements of the mmaped area reserve some address space. */ - size_t reserved; + size_t reserved = RESERVE_MMAP_SIZE; int xflags = 0; - p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_ANON, -1, 0); - if (p != MAP_FAILED) - { - xflags = MAP_FIXED; - reserved = RESERVE_MMAP_SIZE; - } + if (total < RESERVE_MMAP_SIZE + && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_ANON, -1, 0)) + != MAP_FAILED)) + xflags = MAP_FIXED; else { p = NULL; @@ -580,14 +578,13 @@ open_archive (struct locarhandle *ah, bool readonly) /* To prepare for enlargements of the mmaped area reserve some address space. */ - size_t reserved; + size_t reserved = RESERVE_MMAP_SIZE; int xflags = 0; - void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_ANON, -1, 0); - if (p != MAP_FAILED) - { - xflags = MAP_FIXED; - reserved = RESERVE_MMAP_SIZE; - } + void *p; + if (st.st_size < RESERVE_MMAP_SIZE + && ((p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_ANON, -1, 0)) + != MAP_FAILED)) + xflags = MAP_FIXED; else { p = NULL; @@ -612,7 +609,7 @@ close_archive (struct locarhandle *ah) { if (ah->fd != -1) { - munmap (ah->addr, ah->mmaped); + munmap (ah->addr, MAX (ah->reserved, ah->mmaped)); close (ah->fd); } } diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c index 6e32afc43e..73b9565030 100644 --- a/misc/hsearch_r.c +++ b/misc/hsearch_r.c @@ -157,6 +157,8 @@ hsearch_r (item, action, retval, htab) hval <<= 4; hval += item.key[count]; } + if (hval == 0) + ++hval; /* First hash function: simply take the modul but prevent zero. */ idx = hval % htab->size + 1; |