This library contains code that extends and simplifies different operations
for C language based programs.
Revisión | a102e98f17414ef2bebfa8be1bb422b271d37961 (tree) |
---|---|
Tiempo | 2022-08-30 05:24:33 |
Autor | Sergey Gusarov <laborer2008@gmai...> |
Commiter | Sergey Gusarov |
test_os_io: Fixed crash
@@ -132,7 +132,9 @@ | ||
132 | 132 | CT_CHECK_PTR_AND_BREAK(name); |
133 | 133 | |
134 | 134 | // fopenWrapper() do the same things, that's why it's not used here |
135 | - file = fopen(name, "br"); | |
135 | + | |
136 | + // MSVC++: First mode character must be 'r', 'w' or 'a' | |
137 | + file = fopen(name, "rb"); | |
136 | 138 | if (!file) |
137 | 139 | { |
138 | 140 | CT_TRACE_ERRORC("fopen() failed"); |
@@ -63,6 +63,11 @@ | ||
63 | 63 | CT_CHECK_PTR_AND_BREAK(path); |
64 | 64 | CT_CHECK_PTR_AND_BREAK(mode); |
65 | 65 | |
66 | +#if defined(CT_OS_WINDOWS) | |
67 | + if (!(mode[0] == 'a' || mode[0] == 'r' || mode[0] == 'w')) | |
68 | + CT_TRACE_ERRORN('Invalid first mode characted: %c', mode[0]); | |
69 | +#endif | |
70 | + | |
66 | 71 | fopenResult = fopen(path, mode); |
67 | 72 | if (!fopenResult) |
68 | 73 | CT_TRACE_ERRORC("fopen() for \"%s\" with mode=\"%s\" failed", path, mode); |