diff options
author | lloyd <[email protected]> | 2012-07-09 22:50:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-07-09 22:50:00 +0000 |
commit | 84913296d62f59fce5db5c87802c8a026d39c54a (patch) | |
tree | c17589913e95cdd467375e5aaf954e4bfd7edbbd /src/entropy | |
parent | 18a0c6d0b77985d85a22fed8afa3df14de590ca5 (diff) |
Add a patch from Markus Wanner that extends DataSource (including
Pipe) with get_bytes_read() which returns the number of bytes read so
far from that source.
Diffstat (limited to 'src/entropy')
-rw-r--r-- | src/entropy/unix_procs/unix_cmd.cpp | 7 | ||||
-rw-r--r-- | src/entropy/unix_procs/unix_cmd.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/entropy/unix_procs/unix_cmd.cpp b/src/entropy/unix_procs/unix_cmd.cpp index 823da2717..07386dbc5 100644 --- a/src/entropy/unix_procs/unix_cmd.cpp +++ b/src/entropy/unix_procs/unix_cmd.cpp @@ -1,6 +1,7 @@ /* * Unix Command Execution * (C) 1999-2007 Jack Lloyd +* 2012 Markus Wanner * * Distributed under the terms of the Botan license */ @@ -86,6 +87,7 @@ size_t DataSource_Command::read(byte buf[], size_t length) return 0; } + bytes_read += got; return static_cast<size_t>(got); } @@ -107,6 +109,11 @@ bool DataSource_Command::end_of_data() const return (pipe) ? false : true; } +size_t DataSource_Command::get_bytes_read() const + { + return bytes_read; + } + /** * Return the Unix file descriptor of the pipe */ diff --git a/src/entropy/unix_procs/unix_cmd.h b/src/entropy/unix_procs/unix_cmd.h index 5185c1c8f..7c2483c10 100644 --- a/src/entropy/unix_procs/unix_cmd.h +++ b/src/entropy/unix_procs/unix_cmd.h @@ -1,6 +1,7 @@ /* * Unix Command Execution * (C) 1999-2007 Jack Lloyd +* 2012 Markus Wanner * * Distributed under the terms of the Botan license */ @@ -53,6 +54,7 @@ class DataSource_Command : public DataSource size_t peek(byte[], size_t, size_t) const; bool end_of_data() const; std::string id() const; + size_t get_bytes_read() const; int fd() const; @@ -67,6 +69,7 @@ class DataSource_Command : public DataSource std::vector<std::string> arg_list; struct pipe_wrapper* pipe; + size_t bytes_read; }; } |