vdlog: Fix compatibility with MSVC

_wstat64 documentation states that we should include sys/types.h
and sys/stat.h.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Frediano Ziglio 2019-11-26 13:10:12 +00:00
parent 1da442ad73
commit 7aa46954fd

View File

@ -21,6 +21,8 @@
#include <stdio.h>
#include <stdarg.h>
#include <share.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <vector>
#define LOG_ROLL_SIZE (1024 * 1024)
@ -46,7 +48,7 @@ VDLog* VDLog::get(TCHAR* path)
if (_log || !path) {
return _log;
}
__stat64 buf;
struct _stat64 buf;
if (_wstat64(path, &buf) == 0 && buf.st_size > LOG_ROLL_SIZE) {
TCHAR roll_path[MAX_PATH];
swprintf_s(roll_path, MAX_PATH, L"%s.1", path);