summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 618c44a)
raw | patch | inline | side by side (parent: 618c44a)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 20 Oct 2013 19:38:23 +0000 (21:38 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 20 Oct 2013 19:38:23 +0000 (21:38 +0200) |
src/utils/channel.c | patch | blob | history |
diff --git a/src/utils/channel.c b/src/utils/channel.c
index 92d793e468c441b044c24d76bedd2d9dc51510f0..afce6f5d9cc9aa883afb9569aef9a384c433eb01 100644 (file)
--- a/src/utils/channel.c
+++ b/src/utils/channel.c
#include <assert.h>
+#include <errno.h>
+
#include <stdlib.h>
#include <string.h>
struct timespec abstime;
int status = 0;
- if (! chan)
+ if (! chan) {
+ errno = EINVAL;
return -1;
+ }
- if ((! wantread) && (! read_data) && (! wantwrite) && (! write_data))
+ if ((! wantread) && (! read_data) && (! wantwrite) && (! write_data)) {
+ errno = EINVAL;
return -1;
+ }
if (timeout) {
if (clock_gettime(CLOCK_REALTIME, &abstime))
}
pthread_mutex_unlock(&chan->lock);
- return status;
+ if (status) {
+ errno = status;
+ return -1;
+ }
+ return 0;
} /* sdb_channel_select */
int