X-Git-Url: http://git.madism.org/?p=~madcoder%2Fpwqr.git;a=blobdiff_plain;f=lib%2Flibpwqr.c;h=85cccace4ee4b83a3460d866eb953240b338fab7;hp=f5d53a2444d269e870f952320676e1223ac4011c;hb=866e56c8f10d718c24e812335b107a05218dc339;hpb=c78f2216a947e712fff07f6e79f743d9009e60c8;ds=sidebyside diff --git a/lib/libpwqr.c b/lib/libpwqr.c index f5d53a2..85cccac 100644 --- a/lib/libpwqr.c +++ b/lib/libpwqr.c @@ -66,9 +66,13 @@ /* }}} */ /* pwqr wrapping {{{ */ -static int pwqr_create(void) +static int pwqr_create(int flags) { - return open("/dev/"PWQR_DEVICE_NAME, O_RDWR); + if (flags & ~(O_NONBLOCK | O_CLOEXEC)) { + errno = -EINVAL; + return -1; + } + return open("/dev/"PWQR_DEVICE_NAME, O_RDWR | flags); } static int pwqr_ctl(int fd, int op, int val, void *uaddr) @@ -328,7 +332,7 @@ static int _pthread_workqueue_init_np(void) if (pwqr_g.fd >= 0) goto out; - fd = pwqr_create(); + fd = pwqr_create(0); if (fd < 0) { rc = -1; goto out;