summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorLuis Felipe Strano Moraes <lfelipe@profusion.mobi>2011-12-21 11:47:51 -0800
committerLuis Felipe Strano Moraes <lfelipe@profusion.mobi>2011-12-21 11:47:51 -0800
commitf18f225cf1eac9b61849f10f387bc3628332d738 (patch)
treee152e88199a92a1b2ba8625073eba132a4f94e38 /udev
parent28e490c945e16f9d2dce7cff9967ed5d11b23f93 (diff)
Switch spawn_read to void and remove useless stores there.
The return value was never used and even if errors were found inside spawn_wait should still be called.
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-event.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c
index 1ea39967fc..c978e847b7 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -493,7 +493,7 @@ static int spawn_exec(struct udev_event *event,
return err;
}
-static int spawn_read(struct udev_event *event,
+static void spawn_read(struct udev_event *event,
const char *cmd,
int fd_stdout, int fd_stderr,
char *result, size_t ressize)
@@ -502,15 +502,13 @@ static int spawn_read(struct udev_event *event,
size_t respos = 0;
int fd_ep = -1;
struct epoll_event ep_outpipe, ep_errpipe;
- int err = 0;
/* read from child if requested */
if (fd_stdout < 0 && fd_stderr < 0)
- return 0;
+ return;
fd_ep = epoll_create1(EPOLL_CLOEXEC);
if (fd_ep < 0) {
- err = -errno;
err(udev, "error creating epoll fd: %m\n");
goto out;
}
@@ -547,7 +545,6 @@ static int spawn_read(struct udev_event *event,
age_usec = now_usec() - event->birth_usec;
if (age_usec >= event->timeout_usec) {
- err = -ETIMEDOUT;
err(udev, "timeout '%s'\n", cmd);
goto out;
}
@@ -560,12 +557,10 @@ static int spawn_read(struct udev_event *event,
if (fdcount < 0) {
if (errno == EINTR)
continue;
- err = -errno;
err(udev, "failed to poll: %m\n");
goto out;
}
if (fdcount == 0) {
- err = -ETIMEDOUT;
err(udev, "timeout '%s'\n", cmd);
goto out;
}
@@ -589,7 +584,6 @@ static int spawn_read(struct udev_event *event,
respos += count;
} else {
err(udev, "'%s' ressize %zd too short\n", cmd, ressize);
- err = -ENOBUFS;
}
}
@@ -606,7 +600,6 @@ static int spawn_read(struct udev_event *event,
}
} else if (ev[i].events & EPOLLHUP) {
if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) {
- err = -errno;
err(udev, "failed to remove fd from epoll: %m\n");
goto out;
}
@@ -623,7 +616,6 @@ static int spawn_read(struct udev_event *event,
out:
if (fd_ep >= 0)
close(fd_ep);
- return err;
}
static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
@@ -805,9 +797,9 @@ int udev_event_spawn(struct udev_event *event,
errpipe[WRITE_END] = -1;
}
- err = spawn_read(event, cmd,
- outpipe[READ_END], errpipe[READ_END],
- result, ressize);
+ spawn_read(event, cmd,
+ outpipe[READ_END], errpipe[READ_END],
+ result, ressize);
err = spawn_wait(event, cmd, pid);
}