Enable x mode modifier if available

This commit is contained in:
olszomal 2023-11-09 11:38:22 +01:00 committed by Michał Trojnara
parent 8ab8a133f7
commit 57563716d1
2 changed files with 5 additions and 8 deletions

View File

@ -4071,8 +4071,10 @@ int main(int argc, char **argv)
DO_EXIT_0("Unable to set the message digest of BIO\n"); DO_EXIT_0("Unable to set the message digest of BIO\n");
} }
/* Create outdata file */ /* Create outdata file */
outdata = BIO_new_file(options.outfile, FILE_CREATE_MODE); outdata = BIO_new_file(options.outfile, "w+bx");
if (outdata == NULL) { if (!outdata && errno != EEXIST)
outdata = BIO_new_file(options.outfile, "w+b");
if (!outdata) {
BIO_free_all(hash); BIO_free_all(hash);
DO_EXIT_1("Failed to create file: %s\n", options.outfile); DO_EXIT_1("Failed to create file: %s\n", options.outfile);
} }

View File

@ -21,6 +21,7 @@
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <ctype.h> #include <ctype.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
@ -81,12 +82,6 @@
#define PROVIDE_ASKPASS 1 #define PROVIDE_ASKPASS 1
#endif #endif
#ifdef _WIN32
#define FILE_CREATE_MODE "w+b"
#else
#define FILE_CREATE_MODE "w+bx"
#endif
#define GET_UINT8_LE(p) ((const u_char *)(p))[0] #define GET_UINT8_LE(p) ((const u_char *)(p))[0]