From: Yu Watanabe Date: Tue, 8 Jan 2019 17:11:15 +0000 (+0900) Subject: core/socket: drop unnecessary assignment to 'r' X-Git-Tag: v241-rc1~95^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11361%2Fhead;p=thirdparty%2Fsystemd.git core/socket: drop unnecessary assignment to 'r' Follow-up for e5417345289b477a70e7515c71551ad34f968a40. As suggested in #11352. --- diff --git a/src/core/socket.c b/src/core/socket.c index aea56fe3b56..af95e9027e1 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1593,49 +1593,43 @@ static int socket_open_fds(Socket *_s) { break; } - r = socket_address_listen_in_cgroup(s, &p->address, label); - if (r < 0) - return r; + p->fd = socket_address_listen_in_cgroup(s, &p->address, label); + if (p->fd < 0) + return p->fd; - p->fd = r; socket_apply_socket_options(s, p->fd); socket_symlink(s); break; case SOCKET_SPECIAL: - r = special_address_create(p->path, s->writable); - if (r < 0) - return log_unit_error_errno(UNIT(s), r, "Failed to open special file %s: %m", p->path); - - p->fd = r; + p->fd = special_address_create(p->path, s->writable); + if (p->fd < 0) + return log_unit_error_errno(UNIT(s), p->fd, "Failed to open special file %s: %m", p->path); break; case SOCKET_FIFO: - r = fifo_address_create( + p->fd = fifo_address_create( p->path, s->directory_mode, s->socket_mode); - if (r < 0) - return log_unit_error_errno(UNIT(s), r, "Failed to open FIFO %s: %m", p->path); + if (p->fd < 0) + return log_unit_error_errno(UNIT(s), p->fd, "Failed to open FIFO %s: %m", p->path); - p->fd = r; socket_apply_fifo_options(s, p->fd); socket_symlink(s); break; case SOCKET_MQUEUE: - r = mq_address_create( + p->fd = mq_address_create( p->path, s->socket_mode, s->mq_maxmsg, s->mq_msgsize); - if (r < 0) - return log_unit_error_errno(UNIT(s), r, "Failed to open message queue %s: %m", p->path); - - p->fd = r; + if (p->fd < 0) + return log_unit_error_errno(UNIT(s), p->fd, "Failed to open message queue %s: %m", p->path); break; case SOCKET_USB_FUNCTION: { @@ -1643,11 +1637,9 @@ static int socket_open_fds(Socket *_s) { ep = path_make_absolute("ep0", p->path); - r = usbffs_address_create(ep); - if (r < 0) - return r; - - p->fd = r; + p->fd = usbffs_address_create(ep); + if (p->fd < 0) + return p->fd; r = usbffs_write_descs(p->fd, SERVICE(UNIT_DEREF(s->service))); if (r < 0)