system: make system functions return error on error

Return -errno from system functions instead of -1 in errors. This
makes it easier to pass along the result without having to go to
errno etc..
This commit is contained in:
Wim Taymans 2019-06-20 17:31:29 +02:00
parent 03eeb945f3
commit 5b7e95c71c
9 changed files with 154 additions and 157 deletions

View file

@ -237,11 +237,12 @@ impl_init(const struct spa_handle_factory *factory,
this->source.fd = spa_system_eventfd_create(this->system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
this->source.mask = SPA_IO_IN;
this->source.rmask = 0;
if (this->source.fd != -1) {
if (this->source.fd < 0) {
fprintf(stderr, "Warning: failed to create eventfd: %m");
} else {
spa_loop_add_source(loop, &this->source);
this->have_source = true;
} else {
fprintf(stderr, "Warning: failed to create eventfd: %m");
}
}