[SCM] Samba Shared Repository - branch master updated -
4cbb3b23a4e1d5e800b900fe91860eb0a9add12e
Jeremy Allison
jra at samba.org
Fri Oct 10 23:30:44 GMT 2008
The branch, master has been updated
via 4cbb3b23a4e1d5e800b900fe91860eb0a9add12e (commit)
from 430cc443901865a5c781ce4ac5cf65b450ccbe61 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 4cbb3b23a4e1d5e800b900fe91860eb0a9add12e
Author: Jeremy Allison <jra at samba.org>
Date: Fri Oct 10 16:29:14 2008 -0700
Allow data flow to be debugged and only log on error. All seems ok now.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source3/printing/print_cups.c | 48 ++++++++++++++++++++++++++++++++++------
1 files changed, 40 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 1411962..6086bb8 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -392,6 +392,8 @@ static bool cups_pcap_load_async(int *pfd)
int fds[2];
pid_t pid;
+ *pfd = -1;
+
if (cache_fd_event) {
DEBUG(3,("cups_pcap_load_async: already waiting for "
"a refresh event\n" ));
@@ -441,34 +443,56 @@ static void cups_async_callback(struct event_context *event_ctx,
DEBUG(5,("cups_async_callback: callback received for printer data. "
"fd = %d\n", fd));
- TALLOC_FREE(cache_fd_event);
-
while (1) {
char *name = NULL, *info = NULL;
size_t namelen = 0, infolen = 0;
+ ssize_t ret = -1;
- if (sys_read(fd, &namelen, sizeof(namelen)) !=
- sizeof(namelen)) {
+ ret = sys_read(fd, &namelen, sizeof(namelen));
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != sizeof(namelen)) {
DEBUG(10,("cups_async_callback: namelen read failed %d %s\n",
errno, strerror(errno)));
break;
}
- if (sys_read(fd, &infolen, sizeof(infolen)) !=
- sizeof(infolen)) {
+
+ DEBUG(11,("cups_async_callback: read namelen %u\n",
+ (unsigned int)namelen));
+
+ ret = sys_read(fd, &infolen, sizeof(infolen));
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != sizeof(infolen)) {
DEBUG(10,("cups_async_callback: infolen read failed %s\n",
strerror(errno)));
break;
}
+
+ DEBUG(11,("cups_async_callback: read infolen %u\n",
+ (unsigned int)infolen));
+
if (namelen) {
name = TALLOC_ARRAY(frame, char, namelen);
if (!name) {
break;
}
- if (sys_read(fd, name, namelen) != namelen) {
+ ret = sys_read(fd, name, namelen);
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != namelen) {
DEBUG(10,("cups_async_callback: name read failed %s\n",
strerror(errno)));
break;
}
+ DEBUG(11,("cups_async_callback: read name %s\n",
+ name));
} else {
name = NULL;
}
@@ -477,11 +501,18 @@ static void cups_async_callback(struct event_context *event_ctx,
if (!info) {
break;
}
- if (sys_read(fd, info, infolen) != infolen) {
+ ret = sys_read(fd, info, infolen);
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != infolen) {
DEBUG(10,("cups_async_callback: info read failed %s\n",
strerror(errno)));
break;
}
+ DEBUG(11,("cups_async_callback: read info %s\n",
+ info));
} else {
info = NULL;
}
@@ -506,6 +537,7 @@ static void cups_async_callback(struct event_context *event_ctx,
}
close(fd);
TALLOC_FREE(p);
+ TALLOC_FREE(cache_fd_event);
}
bool cups_cache_reload(void)
--
Samba Shared Repository
More information about the samba-cvs
mailing list