aboutsummaryrefslogtreecommitdiff
path: root/nscd/connections.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-07-18 22:28:46 +0000
committerUlrich Drepper <drepper@redhat.com>2005-07-18 22:28:46 +0000
commit233399bce2e79e5af3b344782e9943d5f1a9cdcb (patch)
tree6c178b10c4b4e26409278419bdd2377b48ca7086 /nscd/connections.c
parent9f3731cf7f8f1d1b4718fdbeae2ca5d46bbc6950 (diff)
downloadglibc-233399bce2e79e5af3b344782e9943d5f1a9cdcb.zip
glibc-233399bce2e79e5af3b344782e9943d5f1a9cdcb.tar.gz
glibc-233399bce2e79e5af3b344782e9943d5f1a9cdcb.tar.bz2
* nscd/Makefile (nscd-cflags): Add _FORTIFY_SOURCE.
* nscd/connections.c: Fix a few wur warnings.
Diffstat (limited to 'nscd/connections.c')
-rw-r--r--nscd/connections.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 9dc852a..347862e 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -393,20 +393,23 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
if (offset % ps != 0)
{
towrite = MIN (remaining, ps - (offset % ps));
- pwrite (fd, tmpbuf, towrite, offset);
+ if (pwrite (fd, tmpbuf, towrite, offset) != towrite)
+ goto write_fail;
offset += towrite;
remaining -= towrite;
}
while (remaining > ps)
{
- pwrite (fd, tmpbuf, ps, offset);
+ if (pwrite (fd, tmpbuf, ps, offset) == -1)
+ goto write_fail;
offset += ps;
remaining -= ps;
}
- if (remaining > 0)
- pwrite (fd, tmpbuf, remaining, offset);
+ if (remaining > 0
+ && pwrite (fd, tmpbuf, remaining, offset) != remaining)
+ goto write_fail;
/* Create the header of the file. */
struct database_pers_head head =
@@ -426,6 +429,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
|| (mem = mmap (NULL, total, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0)) == MAP_FAILED)
{
+ write_fail:
unlink (dbs[cnt].db_filename);
dbg_log (_("cannot write to database file %s: %s"),
dbs[cnt].db_filename, strerror (errno));
@@ -965,7 +969,9 @@ cannot change to old working directory: %s; disabling paranoia mode"),
setuid (server_uid);
setgid (server_gid);
}
- chdir ("/");
+ if (chdir ("/") != 0)
+ dbg_log (_("cannot change current working directory to \"/\": %s"),
+ strerror (errno));
paranoia = 0;
}