diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-12-08 08:31:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:47:11 -0500 |
commit | 91abd131e63087b3e7239f7b58542a2f08e4bd66 (patch) | |
tree | d244c2f63c131738e7474660248e09ba95a73d8f /source4/lib/events | |
parent | 35cb1931ed1ceb468694bb825ac4e8656f57fefb (diff) | |
download | samba-91abd131e63087b3e7239f7b58542a2f08e4bd66.tar.gz samba-91abd131e63087b3e7239f7b58542a2f08e4bd66.tar.bz2 samba-91abd131e63087b3e7239f7b58542a2f08e4bd66.zip |
r12123: handle fde == NULL at the correct level
metze
(This used to be commit 1dd5bb60a5047b94034eb084473bb8f4a9926e7c)
Diffstat (limited to 'source4/lib/events')
-rw-r--r-- | source4/lib/events/events.c | 2 | ||||
-rw-r--r-- | source4/lib/events/events_liboop.c | 16 | ||||
-rw-r--r-- | source4/lib/events/events_standard.c | 9 |
3 files changed, 16 insertions, 11 deletions
diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 4e6eeef78e..7aa8d680fc 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -115,6 +115,7 @@ struct fd_event *event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx, */ uint16_t event_get_fd_flags(struct fd_event *fde) { + if (!fde) return 0; return fde->event_ctx->ops->get_fd_flags(fde); } @@ -123,6 +124,7 @@ uint16_t event_get_fd_flags(struct fd_event *fde) */ void event_set_fd_flags(struct fd_event *fde, uint16_t flags) { + if (!fde) return; fde->event_ctx->ops->set_fd_flags(fde, flags); } diff --git a/source4/lib/events/events_liboop.c b/source4/lib/events/events_liboop.c index 54cb8d5a52..d2d80ce075 100644 --- a/source4/lib/events/events_liboop.c +++ b/source4/lib/events/events_liboop.c @@ -20,7 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* NOTE: this code compiles fine, but is completly *UNTESTED* +/* +NOTE: this code compiles fine, but is completly *UNTESTED* and is only commited as example */ @@ -30,6 +31,15 @@ #include <oop.h> +/* + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + NOTE: this code compiles fine, but is completly *UNTESTED* + and is only commited as example + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +*/ + static int oop_event_context_destructor(void *ptr) { struct event_context *ev = talloc_get_type(ptr, struct event_context); @@ -139,8 +149,6 @@ static struct fd_event *oop_event_add_fd(struct event_context *ev, TALLOC_CTX *m */ static uint16_t oop_event_get_fd_flags(struct fd_event *fde) { - if (!fde) return 0; - return fde->flags; } @@ -152,8 +160,6 @@ static void oop_event_set_fd_flags(struct fd_event *fde, uint16_t flags) oop_source_sys *oop_sys; oop_source *oop; - if (!fde) return; - oop_sys = fde->event_ctx->additional_data; oop = oop_sys_source(oop_sys); diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index d521ffa344..1a3bdc1e16 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -240,7 +240,7 @@ static struct fd_event *std_event_add_fd(struct event_context *ev, TALLOC_CTX *m */ static uint16_t std_event_get_fd_flags(struct fd_event *fde) { - return fde?fde->flags:0; + return fde->flags; } /* @@ -251,8 +251,7 @@ static void std_event_set_fd_flags(struct fd_event *fde, uint16_t flags) #if WITH_EPOLL struct event_context *ev; struct std_event_context *std_ev; - if (fde == NULL || - fde->flags == flags) { + if (fde->flags == flags) { return; } ev = fde->event_ctx; @@ -267,9 +266,7 @@ static void std_event_set_fd_flags(struct fd_event *fde, uint16_t flags) } } #endif - if (fde) { - fde->flags = flags; - } + fde->flags = flags; } /* |