You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
update compatibility fix - remove freopen() and fdopen()
freopen() - with "CON" redirection is broken and output always prints to console window; NULL is not allowed in windows
fdopen() - not works plus stdout is not assignable
so _setmode() is the only option
Copy file name to clipboardExpand all lines: generate-cat-file.c
+11-14
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,6 @@
15
15
#include<io.h>
16
16
17
17
#defineIS_WINDOWS
18
-
19
-
#ifdef_O_BINARY
20
-
#defineHAVE_SETMODE
21
-
#endif
22
18
#endif
23
19
24
20
@@ -1290,6 +1286,17 @@ int parse_hwids_arg(char *hwids, struct list_node **hwid)
1290
1286
1291
1287
intmain(intargc, char**argv)
1292
1288
{
1289
+
#ifdefIS_WINDOWS
1290
+
#ifdef_O_BINARY
1291
+
if (_setmode(_fileno(stdout), _O_BINARY) ==-1)
1292
+
#endif
1293
+
{
1294
+
fatal("cannot set binary mode for stdout\noperation canceled due to translation(known \"corruption\" in text mode)\nhttps://stackoverflow.com/a/5537079");
1295
+
}
1296
+
1297
+
#endif/* IS_WINDOWS */
1298
+
1299
+
1293
1300
structpkcs7_toplevels= { 0 };
1294
1301
structknown_oidsoids= { 0 };
1295
1302
@@ -1405,16 +1412,6 @@ int main(int argc, char **argv)
1405
1412
//free(hardware_ids);
1406
1413
//hardware_ids = NULL;
1407
1414
1408
-
#ifdefIS_WINDOWS
1409
-
#ifdefHAVE_SETMODE
1410
-
if (_setmode(_fileno(stdout), _O_BINARY) ==-1)
1411
-
fatal("cannot set binary mode for stdout\noutput canceled due to translation(known \"corruption\" in text mode)\nhttps://stackoverflow.com/a/5537079");
Copy file name to clipboardExpand all lines: strip-pe-image.c
+9-12
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,6 @@
9
9
#include<io.h>
10
10
11
11
#defineIS_WINDOWS
12
-
13
-
#ifdef_O_BINARY
14
-
#defineHAVE_SETMODE
15
-
#endif
16
12
#endif
17
13
18
14
char*read_file(constchar*fname, long*size_return)
@@ -22,20 +18,21 @@ char *read_file(const char *fname, long *size_return)
22
18
FILE*f;
23
19
24
20
#ifdefIS_WINDOWS
25
-
#ifdefHAVE_SETMODE
21
+
#ifdef_O_BINARY
26
22
if (_setmode(_fileno(stdout), _O_BINARY) ==-1)
23
+
#endif
27
24
{
28
-
fprintf(stderr, "cannot set binary mode for stdout\noutput canceled due to translation(known \"corruption\" in text mode)\nhttps://stackoverflow.com/a/5537079");
25
+
fprintf(stderr, "cannot set binary mode for stdout\noperation canceled due to translation(known \"corruption\" in text mode)\nhttps://stackoverflow.com/a/5537079");
0 commit comments