0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 7.4.2080

Problem:    When using PERROR() on some systems assert_fails() does not see
            the error.
Solution:   Make PERROR() always report the error.
This commit is contained in:
Bram Moolenaar
2016-07-20 00:10:51 +02:00
parent 53bdec2ac9
commit b869c0da31
4 changed files with 19 additions and 1 deletions

View File

@@ -521,6 +521,21 @@ emsg_not_now(void)
return FALSE;
}
#if !defined(HAVE_STRERROR) || defined(PROTO)
/*
* Replacement for perror() that behaves more or less like emsg() was called.
* v:errmsg will be set and called_emsg will be set.
*/
void
do_perror(char *msg)
{
perror(msg);
++emsg_silent;
emsg((char_u *)msg);
--emsg_silent;
}
#endif
/*
* emsg() - display an error message
*

View File

@@ -8,6 +8,7 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen);
void reset_last_sourcing(void);
void msg_source(int attr);
int emsg_not_now(void);
void do_perror(char *msg);
int emsg(char_u *s);
int emsg2(char_u *s, char_u *a1);
void emsg_invreg(int name);

View File

@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2080,
/**/
2079,
/**/

View File

@@ -1652,7 +1652,7 @@ typedef UINT32_TYPEDEF UINT32_T;
#ifdef HAVE_STRERROR
# define PERROR(msg) (void)emsg3((char_u *)"%s: %s", (char_u *)msg, (char_u *)strerror(errno))
#else
# define PERROR(msg) perror(msg)
# define PERROR(msg) do_perror(msg)
#endif
typedef long linenr_T; /* line number type */