mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-17 11:04:16 +00:00
Contributed by tixiv@gmx.net:
bug #33345: File auto detection as binary doesn't open file in binary mode on Windows * fileio.c: Move the decision about opening files in binary mode until before the fopen() call. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@964 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
30
fileio.c
30
fileio.c
@@ -1034,21 +1034,6 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
/* Open Raw Binary format in binary mode on Windows.*/
|
||||
if(format == FMT_RBIN)
|
||||
{
|
||||
if(fio.op == FIO_READ)
|
||||
{
|
||||
fio.mode = "rb";
|
||||
}
|
||||
if(fio.op == FIO_WRITE)
|
||||
{
|
||||
fio.mode = "wb";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* point at the requested memory buffer */
|
||||
buf = mem->buf;
|
||||
if (fio.op == FIO_READ)
|
||||
@@ -1100,6 +1085,21 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
/* Open Raw Binary format in binary mode on Windows.*/
|
||||
if(format == FMT_RBIN)
|
||||
{
|
||||
if(fio.op == FIO_READ)
|
||||
{
|
||||
fio.mode = "rb";
|
||||
}
|
||||
if(fio.op == FIO_WRITE)
|
||||
{
|
||||
fio.mode = "wb";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (format != FMT_IMM) {
|
||||
if (!using_stdio) {
|
||||
f = fopen(fname, fio.mode);
|
||||
|
||||
Reference in New Issue
Block a user