[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-4246-gb443507
Jeremy Allison
jra at samba.org
Fri Oct 10 22:55:25 GMT 2008
The branch, v3-3-test has been updated
via b443507a0cc97821af0011b56bc971fea6839a98 (commit)
from d66f58ad1b5c7195ea09a55f733c6f6551f663c2 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit b443507a0cc97821af0011b56bc971fea6839a98
Author: Jeremy Allison <jra at samba.org>
Date: Fri Oct 10 15:54:20 2008 -0700
Async is trickier than it looks :-). Don't use a stack variable for a private data ptr.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/printing/print_cups.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/printing/print_cups.c b/source/printing/print_cups.c
index 6fe24e1..1411962 100644
--- a/source/printing/print_cups.c
+++ b/source/printing/print_cups.c
@@ -505,24 +505,32 @@ static void cups_async_callback(struct event_context *event_ctx,
"printer list\n"));
}
close(fd);
+ TALLOC_FREE(p);
}
bool cups_cache_reload(void)
{
- int fd = -1;
+ int *p_pipe_fd = TALLOC_P(NULL, int);
+
+ if (!p_pipe_fd) {
+ return false;
+ }
/* Set up an async refresh. */
- if (!cups_pcap_load_async(&fd)) {
+ if (!cups_pcap_load_async(p_pipe_fd)) {
return false;
}
if (!local_pcap_copy) {
/* We have no local cache, wait directly for
* async refresh to complete.
*/
+ DEBUG(10,("cups_cache_reload: sync read on fd %d\n",
+ *p_pipe_fd ));
+
cups_async_callback(smbd_event_context(),
NULL,
EVENT_FD_READ,
- (void *)&fd);
+ (void *)p_pipe_fd);
if (!local_pcap_copy) {
return false;
}
@@ -531,14 +539,18 @@ bool cups_cache_reload(void)
* local copy. */
pcap_cache_replace(local_pcap_copy);
+ DEBUG(10,("cups_cache_reload: async read on fd %d\n",
+ *p_pipe_fd ));
+
/* Trigger an event when the pipe can be read. */
cache_fd_event = event_add_fd(smbd_event_context(),
- NULL, fd,
+ NULL, *p_pipe_fd,
EVENT_FD_READ,
cups_async_callback,
- (void *)&fd);
+ (void *)p_pipe_fd);
if (!cache_fd_event) {
- close(fd);
+ close(*p_pipe_fd);
+ TALLOC_FREE(p_pipe_fd);
return false;
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list