mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-08-15 12:27:50 +00:00
Improve O_SYNC logic
This commit is contained in:
@@ -164,8 +164,11 @@ main(int argc, char **argv)
|
||||
}
|
||||
fprintf(stderr, "connecting to %s (%s)", device, speedname);
|
||||
|
||||
#ifndef __APPLE__
|
||||
#ifdef O_SYNC
|
||||
fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY | O_DIRECT | O_SYNC);
|
||||
if(fd < 0 && errno == EINVAL){ // O_SYNC not supported (e.g. raspberian)
|
||||
fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY | O_DIRECT);
|
||||
}
|
||||
#else
|
||||
fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY | O_SYNC );
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user