You'll need to save errno first as printf() can clobber it. Also, strerror() can modify errno as well.

On Sat, Jan 24, 2009 at 4:12 PM, Josh Elsasser <> wrote:
How about printing the errno and/or strerror(errno) value in
ecl_internal_error()? There won't be a valid errno value in every
situation where it's called, but having that information is still more
useful than not.

diff --git src/c/error.d src/c/error.d
index 0214de3..a2f1dcb 100644
--- src/c/error.d
+++ src/c/error.d
@@ -30,6 +30,8 @@ void
 ecl_internal_error(const char *s)
       printf("\nInternal or unrecoverable error in:\n%s\n", s);
+       if (errno)
+               printf("  [%d: %s]\n", errno, strerror(errno));
 #ifdef SIGIOT
       signal(SIGIOT, SIG_DFL); /* avoid getting into a loop with abort */

This email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
Ecls-list mailing list