aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/unix_procs
diff options
context:
space:
mode:
Diffstat (limited to 'src/entropy/unix_procs')
-rw-r--r--src/entropy/unix_procs/unix_cmd.cpp10
-rw-r--r--src/entropy/unix_procs/unix_cmd.h6
2 files changed, 10 insertions, 6 deletions
diff --git a/src/entropy/unix_procs/unix_cmd.cpp b/src/entropy/unix_procs/unix_cmd.cpp
index 34e7c314a..c92c84b4c 100644
--- a/src/entropy/unix_procs/unix_cmd.cpp
+++ b/src/entropy/unix_procs/unix_cmd.cpp
@@ -37,6 +37,7 @@ void do_exec(const std::vector<std::string>& arg_list,
{
const std::string full_path = paths[j] + "/" + arg_list[0];
const char* fsname = full_path.c_str();
+
::execl(fsname, fsname, arg1, arg2, arg3, arg4, NULL);
}
}
@@ -50,7 +51,9 @@ struct pipe_wrapper
{
int fd;
pid_t pid;
- pipe_wrapper() { fd = -1; pid = 0; }
+
+ pipe_wrapper(int f, pid_t p) : fd(f), pid(p) {}
+ ~pipe_wrapper() { ::close(fd); }
};
/**
@@ -152,9 +155,7 @@ void DataSource_Command::create_pipe(const std::vector<std::string>& paths)
}
else if(pid > 0)
{
- pipe = new pipe_wrapper;
- pipe->fd = pipe_fd[0];
- pipe->pid = pid;
+ pipe = new pipe_wrapper(pipe_fd[0], pid);
::close(pipe_fd[1]);
}
else
@@ -200,7 +201,6 @@ void DataSource_Command::shutdown_pipe()
}
}
- ::close(pipe->fd);
delete pipe;
pipe = 0;
}
diff --git a/src/entropy/unix_procs/unix_cmd.h b/src/entropy/unix_procs/unix_cmd.h
index 7decf587f..3abca8f37 100644
--- a/src/entropy/unix_procs/unix_cmd.h
+++ b/src/entropy/unix_procs/unix_cmd.h
@@ -1,4 +1,4 @@
-/**
+/*
* Unix Command Execution
* (C) 1999-2007 Jack Lloyd
*
@@ -20,6 +20,10 @@ namespace Botan {
*/
struct Unix_Program
{
+ /**
+ * @param n is the name and arguments of what we are going run
+ * @param p is the priority level (lower prio numbers get polled first)
+ */
Unix_Program(const char* n, u32bit p)
{ name_and_args = n; priority = p; working = true; }