From 0882e74bf632b5003c8d02c54798f74f4c292d7e Mon Sep 17 00:00:00 2001 From: kanemoto Date: Wed, 5 May 2010 12:55:02 +0000 Subject: * dln.c (aix_loaderror): use execerror for load error on AIX. This can avoid SEGV reported by Perry Smith. [Bug #2063] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ dln.c | 56 +++++++++++++++++--------------------------------------- 2 files changed, 22 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index c752cf716d..4ccdf7797e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed May 5 21:49:31 2010 Yutaka Kanemoto + + * dln.c (aix_loaderror): use execerror for load error on AIX. + This can avoid SEGV reported by Perry Smith. [Bug #2063] + Wed May 5 20:37:54 2010 wanabe * thread_win32.c (w32_wait_events): get GVL before handle interrupt diff --git a/dln.c b/dln.c index 805618da60..04d1fa212c 100644 --- a/dln.c +++ b/dln.c @@ -1174,47 +1174,25 @@ dln_strerror(void) static void aix_loaderror(const char *pathname) { - char *message[1024], errbuf[1024]; - int i,j; - - static const struct errtab { - int errnum; - const char * errstr; - } load_errtab[] = { - {L_ERROR_TOOMANY, "too many errors, rest skipped."}, - {L_ERROR_NOLIB, "can't load library:"}, - {L_ERROR_UNDEF, "can't find symbol in library:"}, - {L_ERROR_RLDBAD, - "RLD index out of range or bad relocation type:"}, - {L_ERROR_FORMAT, "not a valid, executable xcoff file:"}, - {L_ERROR_MEMBER, - "file not an archive or does not contain requested member:"}, - {L_ERROR_TYPE, "symbol table mismatch:"}, - {L_ERROR_ALIGN, "text alignment in file is wrong."}, - {L_ERROR_SYSTEM, "System error:"}, - {L_ERROR_ERRNO, NULL} - }; - -#define LOAD_ERRTAB_LEN (sizeof(load_errtab)/sizeof(load_errtab[0])) + char *message[1024], errbuf[1024]; + int i; #define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1) - - snprintf(errbuf, sizeof(errbuf), "load failed - %s ", pathname); - - message[0] = NULL; - if (!loadquery(L_GETMESSAGES, &message[0], sizeof(message))) - ERRBUF_APPEND(strerror(errno)); - for(i = 0; message[i] && *message[i]; i++) { - int nerr = atoi(message[i]); - for (j=0; j