diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-20 00:10:51 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-20 00:10:51 +0200 |
commit | b869c0da31716ff14bbfd63346d140d0a1d68af7 (patch) | |
tree | 5a182ff0c5cc310da39c4892cc0aed7903ee82bf | |
parent | 53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594 (diff) | |
download | vim-git-b869c0da31716ff14bbfd63346d140d0a1d68af7.tar.gz |
patch 7.4.2080v7.4.2080
Problem: When using PERROR() on some systems assert_fails() does not see
the error.
Solution: Make PERROR() always report the error.
-rw-r--r-- | src/message.c | 15 | ||||
-rw-r--r-- | src/proto/message.pro | 1 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 2 |
4 files changed, 19 insertions, 1 deletions
diff --git a/src/message.c b/src/message.c index 7aec2d613..c49429d0e 100644 --- a/src/message.c +++ b/src/message.c @@ -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 * diff --git a/src/proto/message.pro b/src/proto/message.pro index 27a215de6..5b7064009 100644 --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -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); diff --git a/src/version.c b/src/version.c index febea0a3d..742f78b29 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2080, +/**/ 2079, /**/ 2078, @@ -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 */ |