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-14Lines changed: 11 additions & 14 deletions
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
@@ -1263,6 +1259,17 @@ int parse_hwids_arg(char *hwids, struct list_node **hwid)
1263
1259
1264
1260
intmain(intargc, char**argv)
1265
1261
{
1262
+
#ifdefIS_WINDOWS
1263
+
#ifdef_O_BINARY
1264
+
if (_setmode(_fileno(stdout), _O_BINARY) ==-1)
1265
+
#endif
1266
+
{
1267
+
fatal("cannot set binary mode for stdout\noperation canceled due to translation(known \"corruption\" in text mode)\nhttps://stackoverflow.com/a/5537079");
1268
+
}
1269
+
1270
+
#endif/* IS_WINDOWS */
1271
+
1272
+
1266
1273
structpkcs7_toplevels= { 0 };
1267
1274
structknown_oidsoids= { 0 };
1268
1275
@@ -1377,16 +1384,6 @@ int main(int argc, char **argv)
1377
1384
a_guid=NULL;
1378
1385
hwids=NULL;
1379
1386
1380
-
#ifdefIS_WINDOWS
1381
-
#ifdefHAVE_SETMODE
1382
-
if (_setmode(_fileno(stdout), _O_BINARY) ==-1)
1383
-
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-12Lines changed: 9 additions & 12 deletions
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