summaryrefslogtreecommitdiff
path: root/nscd/mem.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-08-08 20:42:33 +0000
committerUlrich Drepper <drepper@redhat.com>2005-08-08 20:42:33 +0000
commitf54a329a28050846c0475b45f8bf131f66eab996 (patch)
treeafa7b9a28fcc411dd84e30dcc8bd413f4a795866 /nscd/mem.c
parente62995c1121da99a64657bb952b20d08de0b932e (diff)
* nscd/mem.c (mempool_alloc): Use posix_fallocate instead of ftruncate.
* nscd/connections.c (nscd_init): Likewise.
Diffstat (limited to 'nscd/mem.c')
-rw-r--r--nscd/mem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nscd/mem.c b/nscd/mem.c
index a1108f3143..823eda1019 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -21,6 +21,7 @@
#include <assert.h>
#include <errno.h>
#include <error.h>
+#include <fcntl.h>
#include <inttypes.h>
#include <libintl.h>
#include <limits.h>
@@ -488,7 +489,8 @@ mempool_alloc (struct database_dyn *db, size_t len)
+ db->head->module * sizeof (ref_t)
+ new_data_size);
- if ((!db->mmap_used || ftruncate (db->wr_fd, newtotal) != 0)
+ if ((!db->mmap_used
+ || posix_fallocate (db->wr_fd, oldtotal, newtotal) != 0)
/* Try to resize the mapping. Note: no MREMAP_MAYMOVE. */
&& mremap (db->head, oldtotal, newtotal, 0) == 0)
{