Skip to content

Commit

Permalink
MDEV-27142 - postfix
Browse files Browse the repository at this point in the history
Fix build failure in comp_err, if git is configured with default,
platform-specific EOL.

The error happens because comp_err is not prepared to handle extraneous
CR characters from errmgs-utf8.txt. Use fopen in text mode to fix.
  • Loading branch information
vaintroub committed Nov 4, 2022
1 parent 4b87d36 commit 0b9ca3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion extra/comp_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ static uint parse_input_file(const char *file_name, struct errors **top_error,
section_start= er_offset;
section_count= 0;

if (!(file= my_fopen(file_name, O_RDONLY | O_SHARE, MYF(MY_WME))))
if (!(file= my_fopen(file_name, O_RDONLY | O_TEXT | O_SHARE, MYF(MY_WME))))
DBUG_RETURN(0);

while ((str= fgets(buff, sizeof(buff), file)))
Expand Down
3 changes: 3 additions & 0 deletions include/my_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
#else
#define HAVE_SOCK_CLOEXEC
#endif
#ifndef O_TEXT
#define O_TEXT 0
#endif

/* additional file share flags for win32 */
#ifdef _WIN32
Expand Down
2 changes: 2 additions & 0 deletions mysys/my_fopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ static void make_ftype(register char * to, register int flag)

if (flag & FILE_BINARY)
*to++='b';
else if (flag & O_TEXT)
*to++= 't';

if (O_CLOEXEC)
*to++= 'e';
Expand Down

0 comments on commit 0b9ca3e

Please sign in to comment.