Skip to content

Commit

Permalink
stdio: fseeko for Windows.
Browse files Browse the repository at this point in the history
Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
shettyg committed Mar 13, 2014
1 parent 7470e8e commit f69aa25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <config.h>

#include <stdio.h>
#include <sys/types.h>

#ifdef _WIN32
#undef snprintf
Expand Down Expand Up @@ -45,4 +46,15 @@ ovs_vsnprintf(char *s, size_t n, const char *format, va_list args)
}
return needed;
}

int
fseeko(FILE *stream, off_t offset, int whence)
{
int error;
error = _fseeki64(stream, offset, whence);
if (error) {
return -1;
}
return error;
}
#endif /* _WIN32 */
3 changes: 3 additions & 0 deletions lib/stdio.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <stdarg.h>
#include <stddef.h>
#include <sys/types.h>

/* Windows libc has defective snprintf() and vsnprintf():
*
Expand All @@ -38,6 +39,8 @@ int ovs_snprintf(char *, size_t, const char *, ...);
#undef vsnprintf
#define vsnprintf ovs_vsnprintf
int ovs_vsnprintf(char *, size_t, const char *, va_list);

int fseeko(FILE *stream, off_t offset, int whence);
#endif /* _WIN32 */

#endif /* stdio.h wrapper */

0 comments on commit f69aa25

Please sign in to comment.