if (isolate)
mode = "isolate";
else
- mode = "replace";
+ mode = "replace-irreversibly";
log_debug("Running request %s/start/%s", target, mode);
assert(f);
errno = EIO;
- if ((l = read(f->fd, ((uint8_t*) &f->buffer) + f->bytes_read, sizeof(f->buffer) - f->bytes_read)) <= 0) {
-
+ l = read(f->fd,
+ ((uint8_t*) &f->buffer) + f->bytes_read,
+ sizeof(f->buffer) - f->bytes_read);
+ if (l <= 0) {
if (errno == EAGAIN)
return 0;
if (f->server) {
assert(f->server->n_fifos > 0);
f->server->n_fifos--;
- LIST_REMOVE(Fifo, fifo, f->server->fifos, f);
+ LIST_REMOVE(fifo, f->server->fifos, f);
}
if (f->fd >= 0) {
zero(*s);
- if ((s->epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) {
+ s->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
+ if (s->epoll_fd < 0) {
r = -errno;
log_error("Failed to create epoll object: %s", strerror(errno));
goto fail;
fd = SD_LISTEN_FDS_START+i;
- if ((r = sd_is_fifo(fd, NULL)) < 0) {
- log_error("Failed to determine file descriptor type: %s", strerror(-r));
+ r = sd_is_fifo(fd, NULL);
+ if (r < 0) {
+ log_error("Failed to determine file descriptor type: %s",
+ strerror(-r));
goto fail;
}
goto fail;
}
- if (!(f = new0(Fifo, 1))) {
+ f = new0(Fifo, 1);
+ if (!f) {
r = -ENOMEM;
- log_error("Failed to create fifo object: %s", strerror(errno));
+ log_error("Failed to create fifo object: %s",
+ strerror(errno));
goto fail;
}
if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, fd, &ev) < 0) {
r = -errno;
fifo_free(f);
- log_error("Failed to add fifo fd to epoll object: %s", strerror(errno));
+ log_error("Failed to add fifo fd to epoll object: %s",
+ strerror(errno));
goto fail;
}
f->fd = fd;
- LIST_PREPEND(Fifo, fifo, s->fifos, f);
+ LIST_PREPEND(fifo, s->fifos, f);
f->server = s;
s->n_fifos ++;
}
if (bus_connect(DBUS_BUS_SYSTEM, &s->bus, NULL, &error) < 0) {
- log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
+ log_error("Failed to get D-Bus connection: %s",
+ bus_error_message(&error));
+ r = -EIO;
goto fail;
}
}
f = (Fifo*) ev->data.ptr;
-
- if ((r = fifo_process(f)) < 0) {
+ r = fifo_process(f);
+ if (r < 0) {
log_info("Got error on fifo: %s", strerror(-r));
fifo_free(f);
return r;