diff options
Diffstat (limited to 'src/entropy')
-rw-r--r-- | src/entropy/unix_procs/unix_cmd.cpp | 14 | ||||
-rw-r--r-- | src/entropy/unix_procs/unix_cmd.h | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/entropy/unix_procs/unix_cmd.cpp b/src/entropy/unix_procs/unix_cmd.cpp index c92c84b4c..f4ae5054c 100644 --- a/src/entropy/unix_procs/unix_cmd.cpp +++ b/src/entropy/unix_procs/unix_cmd.cpp @@ -26,14 +26,14 @@ namespace { void do_exec(const std::vector<std::string>& arg_list, const std::vector<std::string>& paths) { - const u32bit args = arg_list.size() - 1; + const size_t args = arg_list.size() - 1; const char* arg1 = (args >= 1) ? arg_list[1].c_str() : 0; const char* arg2 = (args >= 2) ? arg_list[2].c_str() : 0; const char* arg3 = (args >= 3) ? arg_list[3].c_str() : 0; const char* arg4 = (args >= 4) ? arg_list[4].c_str() : 0; - for(u32bit j = 0; j != paths.size(); j++) + for(size_t j = 0; j != paths.size(); j++) { const std::string full_path = paths[j] + "/" + arg_list[0]; const char* fsname = full_path.c_str(); @@ -59,7 +59,7 @@ struct pipe_wrapper /** * Read from the pipe */ -u32bit DataSource_Command::read(byte buf[], u32bit length) +size_t DataSource_Command::read(byte buf[], size_t length) { if(end_of_data()) return 0; @@ -85,13 +85,13 @@ u32bit DataSource_Command::read(byte buf[], u32bit length) return 0; } - return static_cast<u32bit>(got); + return static_cast<size_t>(got); } /** * Peek at the pipe contents */ -u32bit DataSource_Command::peek(byte[], u32bit, u32bit) const +size_t DataSource_Command::peek(byte[], size_t, size_t) const { if(end_of_data()) throw Invalid_State("DataSource_Command: Cannot peek when out of data"); @@ -130,7 +130,8 @@ std::string DataSource_Command::id() const void DataSource_Command::create_pipe(const std::vector<std::string>& paths) { bool found_something = false; - for(u32bit j = 0; j != paths.size(); j++) + + for(size_t j = 0; j != paths.size(); j++) { const std::string full_path = paths[j] + "/" + arg_list[0]; if(::access(full_path.c_str(), X_OK) == 0) @@ -139,6 +140,7 @@ void DataSource_Command::create_pipe(const std::vector<std::string>& paths) break; } } + if(!found_something) return; diff --git a/src/entropy/unix_procs/unix_cmd.h b/src/entropy/unix_procs/unix_cmd.h index 2dc55f6d7..a4ad0c180 100644 --- a/src/entropy/unix_procs/unix_cmd.h +++ b/src/entropy/unix_procs/unix_cmd.h @@ -49,8 +49,8 @@ struct Unix_Program class DataSource_Command : public DataSource { public: - u32bit read(byte[], u32bit); - u32bit peek(byte[], u32bit, u32bit) const; + size_t read(byte[], size_t); + size_t peek(byte[], size_t, size_t) const; bool end_of_data() const; std::string id() const; |