string comparison issue on win32 #55

This commit is contained in:
Arun M 2020-06-13 13:06:00 +05:30
parent 9c624ce4e3
commit dafa7dd36b
2 changed files with 6 additions and 2 deletions

View File

@ -236,10 +236,14 @@ namespace util
FILE *file_from_handle(HANDLE h, const char *mode) FILE *file_from_handle(HANDLE h, const char *mode)
{ {
int md; int md;
if (mode == "w") { if (!mode) {
throw OSError("invalid_mode", 0);
}
if (mode[0] == 'w') {
md = _O_WRONLY; md = _O_WRONLY;
} }
else if (mode == "r") { else if (mode[0] == 'r') {
md = _O_RDONLY; md = _O_RDONLY;
} }
else { else {

Binary file not shown.