diff options
author | monty@mysql.com <> | 2004-05-25 22:54:00 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2004-05-25 22:54:00 +0300 |
commit | 390d9898f9adb21c9794b8161749d8e3fcab7820 (patch) | |
tree | b258dbd41e0b45f70adf8c42ee94cce74cd0232f /extra/perror.c | |
parent | 96b6f0a68661a62ba4c92620dac457ad39fc6f0d (diff) | |
parent | 2397f7081af8d5b42b6ec124e68e5279dae2f05a (diff) | |
download | mariadb-git-390d9898f9adb21c9794b8161749d8e3fcab7820.tar.gz |
merge with 4.0 to get Netware patches and fixes for libmysqld.dll
Diffstat (limited to 'extra/perror.c')
-rw-r--r-- | extra/perror.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/extra/perror.c b/extra/perror.c index 1d3d7c70fac..a31889cc26d 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -16,7 +16,7 @@ /* Return error-text for system error messages and nisam messages */ -#define PERROR_VERSION "2.9" +#define PERROR_VERSION "2.10" #include <my_global.h> #include <my_sys.h> @@ -207,8 +207,16 @@ int main(int argc,char *argv[]) else #endif { + /* + 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. + */ + const char *unknown_error= strerror(10000); + for ( ; argc-- > 0 ; argv++) { + found=0; code=atoi(*argv); #ifdef HAVE_NDBCLUSTER_DB @@ -222,7 +230,14 @@ int main(int argc,char *argv[]) else #endif msg = strerror(code); - if (msg) + + /* + Don't print message for not existing error messages or for + unknown errors. We test for 'Uknown Errors' just as an + extra safety for Netware + */ + if (msg && strcmp(msg, "Unknown Error") && + (!unknown_error || strcmp(msg, unknown_error))) { found=1; if (verbose) @@ -241,7 +256,7 @@ int main(int argc,char *argv[]) else { if (verbose) - printf("%3d = %s\n",code,msg); + printf("MySql error: %3d = %s\n",code,msg); else puts(msg); } |