mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-10 19:30:10 +00:00
Revert "Properly check for short writes when sending the response in nscd"
This reverts commit dd31ac7a8e
.
This commit is contained in:
parent
67881f5e92
commit
33c0a3afc7
@ -75,7 +75,6 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
|||||||
const void *key, struct group *grp, uid_t owner,
|
const void *key, struct group *grp, uid_t owner,
|
||||||
struct hashentry *const he, struct datahead *dh, int errval)
|
struct hashentry *const he, struct datahead *dh, int errval)
|
||||||
{
|
{
|
||||||
bool all_written = true;
|
|
||||||
ssize_t total;
|
ssize_t total;
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
time_t t = time (NULL);
|
time_t t = time (NULL);
|
||||||
@ -343,9 +342,6 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
written = writeall (fd, &dataset->resp, dataset->head.recsize);
|
written = writeall (fd, &dataset->resp, dataset->head.recsize);
|
||||||
|
|
||||||
if (written != dataset->head.recsize)
|
|
||||||
all_written = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the record to the database. But only if it has not been
|
/* Add the record to the database. But only if it has not been
|
||||||
@ -405,7 +401,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__builtin_expect (!all_written, 0) && debug_level > 0)
|
if (__builtin_expect (written != total, 0) && debug_level > 0)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||||
|
@ -171,12 +171,10 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
|
|||||||
nip = nip->next;
|
nip = nip->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool all_written;
|
|
||||||
ssize_t total;
|
ssize_t total;
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
time_t timeout;
|
time_t timeout;
|
||||||
out:
|
out:
|
||||||
all_written = true;
|
|
||||||
timeout = MAX_TIMEOUT_VALUE;
|
timeout = MAX_TIMEOUT_VALUE;
|
||||||
if (!any_success)
|
if (!any_success)
|
||||||
{
|
{
|
||||||
@ -381,9 +379,6 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
written = writeall (fd, &dataset->resp, dataset->head.recsize);
|
written = writeall (fd, &dataset->resp, dataset->head.recsize);
|
||||||
|
|
||||||
if (written != dataset->head.recsize)
|
|
||||||
all_written = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -410,7 +405,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
|
|||||||
|
|
||||||
free (groups);
|
free (groups);
|
||||||
|
|
||||||
if (__builtin_expect (!all_written, 0) && debug_level > 0)
|
if (__builtin_expect (written != total, 0) && debug_level > 0)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||||
|
@ -81,7 +81,6 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
const void *key, struct passwd *pwd, uid_t owner,
|
const void *key, struct passwd *pwd, uid_t owner,
|
||||||
struct hashentry *const he, struct datahead *dh, int errval)
|
struct hashentry *const he, struct datahead *dh, int errval)
|
||||||
{
|
{
|
||||||
bool all_written = true;
|
|
||||||
ssize_t total;
|
ssize_t total;
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
time_t t = time (NULL);
|
time_t t = time (NULL);
|
||||||
@ -307,7 +306,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
+ db->head->data_size));
|
+ db->head->data_size));
|
||||||
written = sendfileall (fd, db->wr_fd,
|
written = sendfileall (fd, db->wr_fd,
|
||||||
(char *) &dataset->resp
|
(char *) &dataset->resp
|
||||||
- (char *) db->head, dataset->head.recsize);
|
- (char *) db->head, dataset->head.recsize );
|
||||||
# ifndef __ASSUME_SENDFILE
|
# ifndef __ASSUME_SENDFILE
|
||||||
if (written == -1 && errno == ENOSYS)
|
if (written == -1 && errno == ENOSYS)
|
||||||
goto use_write;
|
goto use_write;
|
||||||
@ -319,9 +318,6 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
written = writeall (fd, &dataset->resp, dataset->head.recsize);
|
written = writeall (fd, &dataset->resp, dataset->head.recsize);
|
||||||
|
|
||||||
if (written != dataset->head.recsize)
|
|
||||||
all_written = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -381,7 +377,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__builtin_expect (!all_written, 0) && debug_level > 0)
|
if (__builtin_expect (written != total, 0) && debug_level > 0)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||||
|
@ -65,7 +65,6 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
|
|||||||
const void *key, struct servent *serv, uid_t owner,
|
const void *key, struct servent *serv, uid_t owner,
|
||||||
struct hashentry *const he, struct datahead *dh, int errval)
|
struct hashentry *const he, struct datahead *dh, int errval)
|
||||||
{
|
{
|
||||||
bool all_written = true;
|
|
||||||
ssize_t total;
|
ssize_t total;
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
time_t t = time (NULL);
|
time_t t = time (NULL);
|
||||||
@ -291,14 +290,14 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
|
|||||||
{
|
{
|
||||||
assert (db->wr_fd != -1);
|
assert (db->wr_fd != -1);
|
||||||
assert ((char *) &dataset->resp > (char *) db->data);
|
assert ((char *) &dataset->resp > (char *) db->data);
|
||||||
assert ((char *) dataset - (char *) db->head
|
assert ((char *) &dataset->resp - (char *) db->head
|
||||||
+ total
|
+ total
|
||||||
<= (sizeof (struct database_pers_head)
|
<= (sizeof (struct database_pers_head)
|
||||||
+ db->head->module * sizeof (ref_t)
|
+ db->head->module * sizeof (ref_t)
|
||||||
+ db->head->data_size));
|
+ db->head->data_size));
|
||||||
written = sendfileall (fd, db->wr_fd,
|
written = sendfileall (fd, db->wr_fd,
|
||||||
(char *) &dataset->resp
|
(char *) &dataset->resp
|
||||||
- (char *) db->head, dataset->head.recsize);
|
- (char *) db->head, total);
|
||||||
# ifndef __ASSUME_SENDFILE
|
# ifndef __ASSUME_SENDFILE
|
||||||
if (written == -1 && errno == ENOSYS)
|
if (written == -1 && errno == ENOSYS)
|
||||||
goto use_write;
|
goto use_write;
|
||||||
@ -309,10 +308,7 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
|
|||||||
use_write:
|
use_write:
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
written = writeall (fd, &dataset->resp, dataset->head.recsize);
|
written = writeall (fd, &dataset->resp, total);
|
||||||
|
|
||||||
if (written != dataset->head.recsize)
|
|
||||||
all_written = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the record to the database. But only if it has not been
|
/* Add the record to the database. But only if it has not been
|
||||||
@ -336,7 +332,7 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__builtin_expect (!all_written, 0) && debug_level > 0)
|
if (__builtin_expect (written != total, 0) && debug_level > 0)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||||
|
Loading…
Reference in New Issue
Block a user