summaryrefslogtreecommitdiff
path: root/extra/perror.c
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-02-16 17:37:56 -0800
committerunknown <jimw@mysql.com>2005-02-16 17:37:56 -0800
commit3ece905301621e8e8b5742a30e82f2e8b2fa59fa (patch)
tree6bf769145ee25ba39f140e3d4c8fea0e71427898 /extra/perror.c
parentcddb5f57dd9b6032293b4c2b3f0c72113cc1bae0 (diff)
downloadmariadb-git-3ece905301621e8e8b5742a30e82f2e8b2fa59fa.tar.gz
Fix output of perror to include whether the error message
corresponds to an OS or MySQL error. (Bug #8517) extra/perror.c: Don't report OS errors that start with 'Unknown Error', and always make clear whether we are reporting an OS or MySQL error message.
Diffstat (limited to 'extra/perror.c')
-rw-r--r--extra/perror.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/extra/perror.c b/extra/perror.c
index b377b360b5c..6e632b20d96 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -245,16 +245,17 @@ int main(int argc,char *argv[])
msg = strerror(code);
/*
- 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
+ We don't print the OS error message if it is the same as the
+ unknown_error message we retrieved above, or it starts with
+ 'Unknown Error' (without regard to case).
*/
- if (msg && strcmp(msg, "Unknown Error") &&
+ if (msg &&
+ my_strnncoll(&my_charset_latin1, msg, 13, "Unknown Error", 13) &&
(!unknown_error || strcmp(msg, unknown_error)))
{
found=1;
if (verbose)
- printf("Error code %3d: %s\n",code,msg);
+ printf("OS error code %3d: %s\n",code,msg);
else
puts(msg);
}
@@ -269,7 +270,7 @@ int main(int argc,char *argv[])
else
{
if (verbose)
- printf("MySQL error: %3d = %s\n",code,msg);
+ printf("MySQL error code %3d: %s\n",code,msg);
else
puts(msg);
}