From: Kern Sibbald Date: Sat, 26 Jul 2014 19:56:04 +0000 (+0200) Subject: Fix orphaned file descriptors during errors X-Git-Tag: Release-7.0.5~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c7182f83ed14779b47a1a8691c0a9080478a19de;p=bacula%2Fbacula Fix orphaned file descriptors during errors --- diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 730de2ab2c..adff580b9a 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -509,6 +509,7 @@ static bool send_list_item(JCR *jcr, const char *code, char *item, BSOCK *fd) fd->msglen = Mmsg(fd->msg, "%s", buf); Dmsg2(500, "Inc/exc len=%d: %s", fd->msglen, fd->msg); if (!fd->send()) { + close_bpipe(bpipe); Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n")); return false; } @@ -534,6 +535,7 @@ static bool send_list_item(JCR *jcr, const char *code, char *item, BSOCK *fd) while (fgets(buf+optlen, sizeof(buf)-optlen, ffd)) { fd->msglen = Mmsg(fd->msg, "%s", buf); if (!fd->send()) { + fclose(ffd); Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n")); return false; }