]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix orphaned file descriptors during errors
authorKern Sibbald <kern@sibbald.com>
Sat, 26 Jul 2014 19:56:04 +0000 (21:56 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 26 Jul 2014 19:56:28 +0000 (21:56 +0200)
bacula/src/dird/fd_cmds.c

index 730de2ab2c5576aca64a118eddc59769bf0c48fe..adff580b9a4212ebe7cac1a1624c7a49745d24c3 100644 (file)
@@ -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;
          }