Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fc35a3e
)
lib: Preserve error properly across flog.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 15 Jan 2013 07:24:26 +0000
(08:24 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 15 Jan 2013 07:24:26 +0000
(08:24 +0100)
lib/cf.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/cf.c
b/lib/cf.c
index
86658f8
..
ba63999
100644
(file)
--- a/
lib/cf.c
+++ b/
lib/cf.c
@@
-306,20
+306,22
@@
static struct chandler stdhandler = {
static int stdhandle(struct child *ch, struct hthead *req, int fd, void (*chinit)(void *), void *idata)
{
struct stdchild *i = ch->pdata;
static int stdhandle(struct child *ch, struct hthead *req, int fd, void (*chinit)(void *), void *idata)
{
struct stdchild *i = ch->pdata;
+ int serr;
if(i->type == CH_SOCKET) {
if(i->fd < 0)
i->fd = stdmkchild(i->argv, chinit, idata);
if(sendreq2(i->fd, req, fd, MSG_NOSIGNAL | MSG_DONTWAIT)) {
if(i->type == CH_SOCKET) {
if(i->fd < 0)
i->fd = stdmkchild(i->argv, chinit, idata);
if(sendreq2(i->fd, req, fd, MSG_NOSIGNAL | MSG_DONTWAIT)) {
- if((errno == EPIPE) || (errno == ECONNRESET)) {
+ serr = errno;
+ if((serr == EPIPE) || (serr == ECONNRESET)) {
/* Assume that the child has crashed and restart it. */
close(i->fd);
i->fd = stdmkchild(i->argv, chinit, idata);
if(!sendreq2(i->fd, req, fd, MSG_NOSIGNAL | MSG_DONTWAIT))
return(0);
}
/* Assume that the child has crashed and restart it. */
close(i->fd);
i->fd = stdmkchild(i->argv, chinit, idata);
if(!sendreq2(i->fd, req, fd, MSG_NOSIGNAL | MSG_DONTWAIT))
return(0);
}
- flog(LOG_ERR, "could not pass on request to child %s: %s", ch->name, strerror(
errno
));
- if(
errno
!= EAGAIN) {
+ flog(LOG_ERR, "could not pass on request to child %s: %s", ch->name, strerror(
serr
));
+ if(
serr
!= EAGAIN) {
close(i->fd);
i->fd = -1;
}
close(i->fd);
i->fd = -1;
}