summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2018-11-07 11:33:00 -0500
committerMichael R Sweet <michael.r.sweet@gmail.com>2018-11-07 11:33:00 -0500
commit72a213482651d42f2fe67dc2689322b2f6a88f0b (patch)
treec3cd80f661e0c9e9d79012de5838127e24b8664d /backend
parent08eac601d07bc8f6a9e3ba4f52dccc66770b1563 (diff)
downloadcups-72a213482651d42f2fe67dc2689322b2f6a88f0b.tar.gz
Fix stuck multi-file jobs (Issue #5359, Issue #5413)
Diffstat (limited to 'backend')
-rw-r--r--backend/socket.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/backend/socket.c b/backend/socket.c
index 675061dd9..68379e95b 100644
--- a/backend/socket.c
+++ b/backend/socket.c
@@ -1,7 +1,7 @@
/*
* AppSocket backend for CUPS.
*
- * Copyright © 2007-2016 by Apple Inc.
+ * Copyright © 2007-2018 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
@@ -397,8 +397,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
lseek(print_fd, 0, SEEK_SET);
}
- tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1,
- 0, backendNetworkSideCB);
+ if ((bytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, 0, backendNetworkSideCB)) < 0)
+ tbytes = -1;
+ else
+ tbytes = bytes;
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintFilter(stderr, "INFO", _("Print file sent."));
@@ -406,7 +408,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
fputs("STATE: +cups-waiting-for-job-completed\n", stderr);
- if (waiteof)
+ if (waiteof && tbytes >= 0)
{
/*
* Shutdown the socket and wait for the other end to finish...
@@ -443,7 +445,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (print_fd != 0)
close(print_fd);
- return (CUPS_BACKEND_OK);
+ return (tbytes >= 0 ? CUPS_BACKEND_OK : CUPS_BACKEND_FAILED);
}