diff options
author | unknown <msvensson@neptunus.(none)> | 2006-07-24 18:05:00 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-07-24 18:05:00 +0200 |
commit | 0227a7b066bc64a05ab81dc8859227545829a386 (patch) | |
tree | f4a14ddae682a0477f5f3db598ec3c4d7a7ac802 /extra/perror.c | |
parent | 464cadc99dcfbeda1a814d4a090e10f76f090976 (diff) | |
download | mariadb-git-0227a7b066bc64a05ab81dc8859227545829a386.tar.gz |
Bug#20145 perror segfault when call it with error nr
- Add test case(execute perror)
- Check if strerror has returned NULL and set msg to "Unknown Error" in that case
- Thanks to Steven Xie for pointing out how to fix.
extra/perror.c:
strerror might return NULL on Solaris 2.8
mysql-test/mysql-test-run.pl:
Add possibility to execute perror from test case
mysql-test/r/have_perror.require:
New BitKeeper file ``mysql-test/r/have_perror.require''
mysql-test/r/perror.result:
New BitKeeper file ``mysql-test/r/perror.result''
mysql-test/t/perror.test:
New BitKeeper file ``mysql-test/t/perror.test''
Diffstat (limited to 'extra/perror.c')
-rw-r--r-- | extra/perror.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/extra/perror.c b/extra/perror.c index 82311c1b2c9..531d30dae86 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -218,8 +218,11 @@ int main(int argc,char *argv[]) On some system, like NETWARE, strerror(unknown_error) returns a string 'Unknown Error'. To avoid printing it we try to find the error string by asking for an impossible big error message. + + On Solaris 2.8 it might return NULL */ - msg= strerror(10000); + if ((msg= strerror(10000)) == NULL) + msg= "Unknown Error"; /* Allocate a buffer for unknown_error since strerror always returns |