diff options
author | Damien George <damien.p.george@gmail.com> | 2014-07-19 18:40:49 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-07-19 18:40:49 +0100 |
commit | 04c9fec7d1b8666fc3210f41619dff2465b42227 (patch) | |
tree | 865bc1a167e0e0e7b45d9de85b4b29c68d0ecc05 /unix | |
parent | 2c0701101baac40ccc72907e0fd92dbae1e9cd3c (diff) | |
parent | 73ab8cc21d68a65a1ef0ca42c9c2c5c8b0be0953 (diff) | |
download | micropython-04c9fec7d1b8666fc3210f41619dff2465b42227.tar.gz micropython-04c9fec7d1b8666fc3210f41619dff2465b42227.zip |
Merge pull request #757 from stinos/windows-fsync
Add fsync for windows, i.e. _commit. See dce8876
Diffstat (limited to 'unix')
-rw-r--r-- | unix/file.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/unix/file.c b/unix/file.c index 056a7b6e84..7cf0a51932 100644 --- a/unix/file.c +++ b/unix/file.c @@ -39,6 +39,10 @@ #include "runtime.h" #include "stream.h" +#ifdef _WIN32 +#define fsync _commit +#endif + typedef struct _mp_obj_fdfile_t { mp_obj_base_t base; int fd; @@ -83,12 +87,9 @@ STATIC mp_int_t fdfile_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int } STATIC mp_obj_t fdfile_flush(mp_obj_t self_in) { -#ifndef _WIN32 mp_obj_fdfile_t *self = self_in; + check_fd_is_open(self); fsync(self->fd); -#else - //TODO -#endif return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_flush_obj, fdfile_flush); |