summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2009-06-26 22:23:28 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2009-06-26 22:23:28 +0000
commit4e6f60f000516756b3d46d42728d5a6c14f1f5fa (patch)
treed3c0351fe82f40f07fcea56e3f6bad51131a5f4a /backend
parentacb056cb175d1a003334c130e8e6bf3aa8edbff2 (diff)
Merge changes from CUPS 1.4svn-r8731 (1.4.0)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1572 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'backend')
-rw-r--r--backend/ipp.c21
-rw-r--r--backend/lpd.c16
-rw-r--r--backend/runloop.c8
3 files changed, 11 insertions, 34 deletions
diff --git a/backend/ipp.c b/backend/ipp.c
index dac359766..4301b2eab 100644
--- a/backend/ipp.c
+++ b/backend/ipp.c
@@ -409,8 +409,6 @@ main(int argc, /* I - Number of command-line args */
int fd; /* File descriptor */
http_addrlist_t *addrlist; /* Address list */
- char buffer[8192]; /* Buffer for copying */
- int bytes; /* Number of bytes read */
off_t tbytes; /* Total bytes copied */
@@ -434,23 +432,8 @@ main(int argc, /* I - Number of command-line args */
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
- tbytes = 0;
-
- while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
- {
- if (write(fd, buffer, bytes) < bytes)
- {
- _cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
- close(fd);
- unlink(tmpfilename);
- return (CUPS_BACKEND_FAILED);
- }
- else
- tbytes += bytes;
-
- if (snmp_fd >= 0)
- backendCheckSideChannel(snmp_fd, &(addrlist->addr));
- }
+ tbytes = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0,
+ backendNetworkSideCB);
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
diff --git a/backend/lpd.c b/backend/lpd.c
index d6597cf1c..2bb154d3e 100644
--- a/backend/lpd.c
+++ b/backend/lpd.c
@@ -425,8 +425,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
http_addrlist_t *addrlist; /* Address list */
int snmp_fd; /* SNMP socket */
- char buffer[8192]; /* Buffer for copying */
- int bytes; /* Number of bytes read */
fputs("STATE: +connecting-to-device\n", stderr);
@@ -449,19 +447,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
_cupsLangPuts(stderr, _("INFO: Copying print data...\n"));
- while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
- {
- if (write(fd, buffer, bytes) < bytes)
- {
- _cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
- close(fd);
- unlink(tmpfilename);
- return (CUPS_BACKEND_FAILED);
- }
-
- if (snmp_fd >= 0)
- backendCheckSideChannel(snmp_fd, &(addrlist->addr));
- }
+ backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, backendNetworkSideCB);
if (snmp_fd >= 0)
_cupsSNMPClose(snmp_fd);
diff --git a/backend/runloop.c b/backend/runloop.c
index 5806c953f..fa8825ce2 100644
--- a/backend/runloop.c
+++ b/backend/runloop.c
@@ -196,6 +196,14 @@ backendRunLoop(
signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
+ else if (print_fd < 0)
+ {
+ /*
+ * Copy print data from stdin, but don't mess with the signal handlers...
+ */
+
+ print_fd = 0;
+ }
/*
* Figure out the maximum file descriptor value to use with select()...