diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-08 18:53:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-09 08:20:19 +0200 |
commit | 66e405837bf250f50472c886f9c7452634ca3776 (patch) | |
tree | 3692d7ab79969d49ec031c2a5742520cfb500f5f /src/udev/udev-event.c | |
parent | a1e58e8ee1c84b633d6d6d651d5328d4dd4eba5b (diff) |
tree-wide: make more code use safe_close()
Replace this:
close(fd);
fd = -1;
write this:
fd = safe_close(fd);
Diffstat (limited to 'src/udev/udev-event.c')
-rw-r--r-- | src/udev/udev-event.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 4761222786..f2b165076d 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -754,12 +754,10 @@ int udev_event_spawn(struct udev_event *event, /* child closes parent's ends of pipes */ if (outpipe[READ_END] >= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; + outpipe[READ_END] = safe_close(outpipe[READ_END]); } if (errpipe[READ_END] >= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; + errpipe[READ_END] = safe_close(errpipe[READ_END]); } strscpy(arg, sizeof(arg), cmd); @@ -785,12 +783,10 @@ int udev_event_spawn(struct udev_event *event, default: /* parent closed child's ends of pipes */ if (outpipe[WRITE_END] >= 0) { - close(outpipe[WRITE_END]); - outpipe[WRITE_END] = -1; + outpipe[WRITE_END] = safe_close(outpipe[WRITE_END]); } if (errpipe[WRITE_END] >= 0) { - close(errpipe[WRITE_END]); - errpipe[WRITE_END] = -1; + errpipe[WRITE_END] = safe_close(errpipe[WRITE_END]); } spawn_read(event, |