diff options
author | Volker Lendecke <vl@samba.org> | 2008-03-18 13:20:10 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2008-03-18 13:49:46 +0100 |
commit | 16cbc22a99c0a302d248dc006ac0016042c1e3ec (patch) | |
tree | 6a1e98392cf2379eb4737cb7a6318cc5c7b844a2 /source3/lib | |
parent | c5356479c1953b15fee8097d5d3436204fc7a4ce (diff) | |
download | samba-16cbc22a99c0a302d248dc006ac0016042c1e3ec.tar.gz samba-16cbc22a99c0a302d248dc006ac0016042c1e3ec.tar.bz2 samba-16cbc22a99c0a302d248dc006ac0016042c1e3ec.zip |
Fix bug 5334
I did not test with a zero length file :-)
(This used to be commit 7d7a73944c2dcf078f7bc8de65d575f32f9aa851)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/async_req.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/lib/async_req.c b/source3/lib/async_req.c index 01154ca436..2e85d9a38d 100644 --- a/source3/lib/async_req.c +++ b/source3/lib/async_req.c @@ -58,6 +58,36 @@ void async_req_error(struct async_req *req, NTSTATUS status) } } +static void async_trigger(struct event_context *ev, struct timed_event *te, + const struct timeval *now, void *priv) +{ + struct async_req *req = talloc_get_type_abort(priv, struct async_req); + + TALLOC_FREE(te); + if (NT_STATUS_IS_OK(req->status)) { + async_req_done(req); + } + else { + async_req_error(req, req->status); + } +} + +bool async_post_status(struct async_req *req, NTSTATUS status) +{ + /* + * Used if a request is finished before it even started + */ + + req->status = status; + + if (event_add_timed(req->event_ctx, req, timeval_zero(), + "async_trigger", + async_trigger, req) == NULL) { + return false; + } + return true; +} + bool async_req_nomem(const void *p, struct async_req *req) { if (p != NULL) { |