Garmin Descent: make sure to open FIT file with O_BINARY if it exists
Primoz seems to have problems downloading dives from the Garmin Descent, even when the same files work fine for me. I suspect it's some Windows issue, and the primary suspect would be the usual CR/LF text conversion. Using O_BINARY would seem to be the obviously correct thing to do, and won't hurt. Reported-by: Primoz P <primozicp@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5456475fd5
commit
419b0e0498
@ -167,6 +167,10 @@ static int get_file_list(DIR *dir, struct file_list *files)
|
||||
return DC_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
static dc_status_t
|
||||
read_file(char *pathname, int pathlen, const char *name, dc_buffer_t *file)
|
||||
{
|
||||
@ -174,7 +178,7 @@ read_file(char *pathname, int pathlen, const char *name, dc_buffer_t *file)
|
||||
|
||||
pathname[pathlen] = '/';
|
||||
memcpy(pathname+pathlen+1, name, FIT_NAME_SIZE);
|
||||
fd = open(pathname, O_RDONLY);
|
||||
fd = open(pathname, O_RDONLY | O_BINARY);
|
||||
|
||||
if (fd < 0)
|
||||
return DC_STATUS_IO;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user