/** @param f File that we were trying to read from.
* @param e errno value, or 0.
*/
- ReadFileError (std::string f, int e)
+ ReadFileError (std::string f, int e = 0)
: FileError ("", f)
{
std::stringstream s;
int to_do = filesystem::file_size (*i);
ssh_scp_push_file (sc.scp, leaf.c_str(), to_do, S_IRUSR | S_IWUSR);
-
- int fd = open (filesystem::path (*i).string().c_str(), O_RDONLY);
- if (fd == 0) {
+
+ FILE* f = fopen (filesystem::path (*i).string().c_str(), "rb");
+ if (f == 0) {
stringstream s;
s << "Could not open " << *i << " to send";
throw NetworkError (s.str ());
while (to_do > 0) {
int const t = min (to_do, buffer_size);
- read (fd, buffer, t);
+ size_t const read = fread (buffer, 1, t, f);
+ if (read != size_t (t)) {
+ throw ReadFileError (filesystem::path (*i).string());
+ }
+
r = ssh_scp_write (sc.scp, buffer, t);
if (r != SSH_OK) {
stringstream s;
set_progress ((double) bytes_transferred / bytes_to_transfer);
}
+
+ fclose (f);
}
set_progress (1);
if conf.options.target_windows:
conf.env.append_value('CXXFLAGS', ['-DDVDOMATIC_WINDOWS'])
- conf.env.append_value('LINKFLAGS', '-mwindows')
+# conf.env.append_value('LINKFLAGS', '-mwindows')
conf.options.disable_player = True
conf.check(lib = 'ws2_32', uselib_store = 'WINSOCK2', msg = "Checking for library winsock2")
boost_lib_suffix = '-mt'