diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-08 18:58:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-09 08:20:19 +0200 |
commit | 7f6e12b03300ba3e473ce6b85d823fc0375b335e (patch) | |
tree | c60a5f1afa25a4f5a4fde12ce49047054c489a34 /src/udev | |
parent | 66e405837bf250f50472c886f9c7452634ca3776 (diff) |
tree-wide: drop redundant if checks before safe_close()
Replace this:
if (fd >= 0)
safe_close(fd);
by this:
safe_close(fd);
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-event.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index f2b165076d..8ba6aed00e 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -753,12 +753,8 @@ int udev_event_spawn(struct udev_event *event, char program[UTIL_PATH_SIZE]; /* child closes parent's ends of pipes */ - if (outpipe[READ_END] >= 0) { - outpipe[READ_END] = safe_close(outpipe[READ_END]); - } - if (errpipe[READ_END] >= 0) { - errpipe[READ_END] = safe_close(errpipe[READ_END]); - } + outpipe[READ_END] = safe_close(outpipe[READ_END]); + errpipe[READ_END] = safe_close(errpipe[READ_END]); strscpy(arg, sizeof(arg), cmd); udev_build_argv(event->udev, arg, NULL, argv); @@ -782,12 +778,8 @@ int udev_event_spawn(struct udev_event *event, goto out; default: /* parent closed child's ends of pipes */ - if (outpipe[WRITE_END] >= 0) { - outpipe[WRITE_END] = safe_close(outpipe[WRITE_END]); - } - if (errpipe[WRITE_END] >= 0) { - errpipe[WRITE_END] = safe_close(errpipe[WRITE_END]); - } + outpipe[WRITE_END] = safe_close(outpipe[WRITE_END]); + errpipe[WRITE_END] = safe_close(errpipe[WRITE_END]); spawn_read(event, timeout_usec, |