summaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-02-04 22:36:03 +0000
committerJakub Jelinek <jakub@redhat.com>2009-02-04 22:36:03 +0000
commit73c5dd45bc405428148ee740cac61a1279fe57d4 (patch)
tree878555d8c116d7ac9cb716b79e10d240fde946a3 /nscd
parent23a4b43d6a98912d505458daeced44b22830a773 (diff)
Updated to fedora-glibc-20090204T2135cvs/fedora-glibc-2_9_90-3
Diffstat (limited to 'nscd')
-rw-r--r--nscd/connections.c5
-rw-r--r--nscd/mem.c23
-rw-r--r--nscd/nscd.c5
3 files changed, 17 insertions, 16 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index dd934c1106..7e3a406185 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1,5 +1,5 @@
/* Inner loops of cache daemon.
- Copyright (C) 1998-2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1998-2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -647,6 +647,9 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
if (fd != -1)
close (fd);
}
+ else if (errno == EACCES)
+ error (EXIT_FAILURE, 0, _("cannot access '%s'"),
+ dbs[cnt].db_filename);
}
if (dbs[cnt].head == NULL)
diff --git a/nscd/mem.c b/nscd/mem.c
index e821729dab..7f3ea06f4a 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -1,5 +1,5 @@
/* Cache memory handling.
- Copyright (C) 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -134,12 +134,11 @@ gc (struct database_dyn *db)
stack_used = 0;
size_t nmark = (db->head->first_free / BLOCK_ALIGN + BITS - 1) / BITS;
size_t memory_needed = nmark * sizeof (BITMAP_T);
- if (stack_used + memory_needed <= MAX_STACK_USE)
+ if (__builtin_expect (stack_used + memory_needed <= MAX_STACK_USE, 1))
{
- mark = (BITMAP_T *) alloca (memory_needed);
+ mark = (BITMAP_T *) alloca_account (memory_needed, stack_used);
mark_use_malloc = false;
memset (mark, '\0', memory_needed);
- stack_used += memory_needed;
}
else
{
@@ -153,19 +152,17 @@ gc (struct database_dyn *db)
struct hashentry **he;
struct hashentry **he_data;
bool he_use_malloc;
- if (stack_used + memory_needed <= MAX_STACK_USE)
+ if (__builtin_expect (stack_used + memory_needed <= MAX_STACK_USE, 1))
{
- he = alloca (db->head->nentries * sizeof (struct hashentry *));
- he_data = alloca (db->head->nentries * sizeof (struct hashentry *));
+ he = alloca_account (memory_needed, stack_used);
he_use_malloc = false;
- stack_used += memory_needed;
}
else
{
he = xmalloc (memory_needed);
- he_data = &he[db->head->nentries * sizeof (struct hashentry *)];
he_use_malloc = true;
}
+ he_data = &he[db->head->nentries];
size_t cnt = 0;
for (size_t idx = 0; idx < db->head->module; ++idx)
@@ -373,11 +370,9 @@ gc (struct database_dyn *db)
ref_t disp = off_alloc - off_free;
struct moveinfo *new_move;
- if (stack_used + sizeof (*new_move) <= MAX_STACK_USE)
- {
- new_move = alloca (sizeof (*new_move));
- stack_used += sizeof (*new_move);
- }
+ if (__builtin_expect (stack_used + sizeof (*new_move) <= MAX_STACK_USE,
+ 1))
+ new_move = alloca_account (sizeof (*new_move), stack_used);
else
new_move = obstack_alloc (&ob, sizeof (*new_move));
new_move->from = db->data + off_alloc;
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 08bf1f1260..1129cf8480 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -338,7 +338,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
if (cnt == lastdb)
- return ARGP_ERR_UNKNOWN;
+ {
+ argp_error (state, _("'%s' is not a known database"), arg);
+ return EINVAL;
+ }
size_t arg_len = strlen (arg) + 1;
struct