index 685ffb6cfeb77d7573156f4cec6332fc0cabdce7..901a3817065e32a46d623363b82be529840945a2 100644 (file)
--- a/io.c
+++ b/io.c
{
int argc;
+ argv_free(*dst);
for (argc = 0; src[argc]; argc++)
if (!argv_append(dst, src[argc]))
return FALSE;
@@ -182,6 +183,9 @@ io_run(struct io *io, enum io_type type, const char *dir, const char *argv[], ..
io_init(io);
+ if (dir && !strcmp(dir, argv[0]))
+ return io_open(io, "%s%s", dir, argv[1]);
+
if ((type == IO_RD || type == IO_WR) && pipe(pipefds) < 0) {
io->error = errno;
return FALSE;
}
bool
-io_can_read(struct io *io)
+io_can_read(struct io *io, bool can_block)
{
struct timeval tv = { 0, 500 };
fd_set fds;
FD_ZERO(&fds);
FD_SET(io->pipe, &fds);
- return select(io->pipe + 1, &fds, NULL, NULL, &tv) > 0;
+ return select(io->pipe + 1, &fds, NULL, NULL, can_block ? NULL : &tv) > 0;
}
ssize_t