Skip to content

Commit eadd01d

Browse files
committed
Fix double-close, found by Coverity Scan
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 80b0750 commit eadd01d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/service.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,12 @@ static int service_start(svc_t *svc)
721721
}
722722
/* fallthrough */
723723
case SVC_NOTIFY_S6:
724-
close(fd); /* client-end of pipefd for s6 notify */
724+
if (svc->notify == SVC_NOTIFY_S6)
725+
close(fd); /* client-end of pipefd for s6 notify */
726+
725727
result = uev_io_init(ctx, &svc->notify_watcher, service_notify_cb, svc, sd, UEV_READ);
726728
if (result < 0) {
727729
err(1, "%s: failed setting up notify callback", svc_ident(svc, NULL, 0));
728-
if (svc->notify == SVC_NOTIFY_S6)
729-
close(fd);
730730
close(sd);
731731
break;
732732
}

0 commit comments

Comments
 (0)