1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00
committer: mfx <mfx> 1049665135 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2003-04-06 21:38:55 +00:00
parent a3e80b1628
commit b8a9b321fa

View File

@ -109,12 +109,15 @@ static void pr_error(const char *iname, const char *msg, bool is_warning)
void printErr(const char *iname, const Throwable *e) void printErr(const char *iname, const Throwable *e)
{ {
char buf[1024]; char buf[1024];
size_t l;
upx_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e).name())); upx_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e).name()));
if (e->getMsg()) l = strlen(buf);
upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),": %s", e->getMsg()); if (l < sizeof(buf) && e->getMsg())
if (e->getErrno()) upx_snprintf(buf+l, sizeof(buf)-l, ": %s", e->getMsg());
upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),": %s", strerror(e->getErrno())); l = strlen(buf);
if (l < sizeof(buf) && e->getErrno())
upx_snprintf(buf+l, sizeof(buf)-l, ": %s", strerror(e->getErrno()));
pr_error(iname,buf,e->isWarning()); pr_error(iname,buf,e->isWarning());
} }