Avoid write to invalid file descriptor in nscd

When readding entries to the group and services cache and the lookup
is unsuccesful, we tried to write the notfound record.  Just don't
do it in this case.
This commit is contained in:
Ulrich Drepper 2011-06-29 23:33:38 -04:00
parent 5c0b8d9013
commit cf3b23ffcd
3 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2011-06-29 Ulrich Drepper <drepper@gmail.com>
* nscd/grpcache.c (cache_addgr): Don't write notfound reply if we
are re-adding the entry.
* nscd/servicescache.c (cache_addserv): Likewise.
2011-06-28 Ulrich Drepper <drepper@gmail.com>
[BZ #12935]

View file

@ -114,6 +114,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
case. */
total = sizeof (notfound);
if (fd != -1)
written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
MSG_NOSIGNAL));

View file

@ -104,6 +104,7 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
case. */
total = sizeof (notfound);
if (fd != -1)
written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
MSG_NOSIGNAL));