diff options
author | Jeremy Allison <jra@samba.org> | 2009-02-24 12:35:33 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-02-24 12:35:33 -0800 |
commit | c21d54f913c770f3530de500768919a2debbcc61 (patch) | |
tree | d01951fdfed3edf7f448b42e1b24c3fe4c0c269f /lib/util/tevent_unix.c | |
parent | 3a88316e233079199117731756d35d0aea4670e4 (diff) | |
parent | e3746ac922c29f90d0dbb23a76f5387daf21c8c3 (diff) | |
download | samba-c21d54f913c770f3530de500768919a2debbcc61.tar.gz samba-c21d54f913c770f3530de500768919a2debbcc61.tar.bz2 samba-c21d54f913c770f3530de500768919a2debbcc61.zip |
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
Diffstat (limited to 'lib/util/tevent_unix.c')
-rw-r--r-- | lib/util/tevent_unix.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/util/tevent_unix.c b/lib/util/tevent_unix.c new file mode 100644 index 0000000000..b89d5cd4d4 --- /dev/null +++ b/lib/util/tevent_unix.c @@ -0,0 +1,46 @@ +/* + Unix SMB/CIFS implementation. + Wrap unix errno around tevent_req + Copyright (C) Volker Lendecke 2009 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "tevent_unix.h" +#include "../replace/replace.h" + +bool tevent_req_is_unix_error(struct tevent_req *req, int *perrno) +{ + enum tevent_req_state state; + uint64_t err; + + if (!tevent_req_is_error(req, &state, &err)) { + return false; + } + switch (state) { + case TEVENT_REQ_TIMED_OUT: + *perrno = ETIMEDOUT; + break; + case TEVENT_REQ_NO_MEMORY: + *perrno = ENOMEM; + break; + case TEVENT_REQ_USER_ERROR: + *perrno = err; + break; + default: + *perrno = EINVAL; + break; + } + return true; +} |