From: Gabe Black Date: Mon, 13 Jun 2011 06:51:59 +0000 (-0700) Subject: LibElf: Build the error management code in libelf. X-Git-Tag: stable_2012_02_02~276 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7bc68151b701931307a7d333f55e44baff665302;p=gem5.git LibElf: Build the error management code in libelf. This change makes some minor changes to get the error management code in libelf to build on Linux and to build it into the library. --- diff --git a/ext/libelf/SConscript b/ext/libelf/SConscript index 41627e90c..1e7fbb465 100644 --- a/ext/libelf/SConscript +++ b/ext/libelf/SConscript @@ -40,6 +40,8 @@ ElfFile('elf_begin.c') ElfFile('elf_cntl.c') ElfFile('elf_data.c') ElfFile('elf_end.c') +ElfFile('elf_errmsg.c') +ElfFile('elf_errno.c') ElfFile('elf_fill.c') ElfFile('elf_flag.c') ElfFile('elf_getarhdr.c') diff --git a/ext/libelf/_libelf.h b/ext/libelf/_libelf.h index a811abb1a..f6cec6e32 100644 --- a/ext/libelf/_libelf.h +++ b/ext/libelf/_libelf.h @@ -30,6 +30,7 @@ #define __LIBELF_H_ #include "elf_queue.h" +#include "libelf.h" #ifndef NULL #define NULL ((void *) 0) diff --git a/ext/libelf/elf_errmsg.c b/ext/libelf/elf_errmsg.c index 88607ebf4..5fafd5f5d 100644 --- a/ext/libelf/elf_errmsg.c +++ b/ext/libelf/elf_errmsg.c @@ -71,10 +71,10 @@ elf_errmsg(int error) if (error < 0 || error >= ELF_E_NUM) return _libelf_errors[ELF_E_NUM]; if (oserr) { - strlcpy(LIBELF_PRIVATE(msg), _libelf_errors[error], + strncpy(LIBELF_PRIVATE(msg), _libelf_errors[error], sizeof(LIBELF_PRIVATE(msg))); - strlcat(LIBELF_PRIVATE(msg), ": ", sizeof(LIBELF_PRIVATE(msg))); - strlcat(LIBELF_PRIVATE(msg), strerror(oserr), + strncat(LIBELF_PRIVATE(msg), ": ", sizeof(LIBELF_PRIVATE(msg))); + strncat(LIBELF_PRIVATE(msg), strerror(oserr), sizeof(LIBELF_PRIVATE(msg))); return (const char *)&LIBELF_PRIVATE(msg); }