diff options
author | dfr <dfr@FreeBSD.org> | 2008-05-08 11:01:46 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2008-05-08 11:01:46 +0000 |
commit | 62929665b739d66740a668830f004f9463f3ced9 (patch) | |
tree | 29031943aed09b2fbdbdc248e2868d86477d1ea3 /contrib/com_err/com_err.c | |
parent | e240fee79046f8dbba1a0ff52d7d6d7db5d9ecf4 (diff) | |
download | FreeBSD-src-62929665b739d66740a668830f004f9463f3ced9.zip FreeBSD-src-62929665b739d66740a668830f004f9463f3ced9.tar.gz |
Merge from the vendor branch and resolve conflicts.
Diffstat (limited to 'contrib/com_err/com_err.c')
-rw-r--r-- | contrib/com_err/com_err.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/contrib/com_err/com_err.c b/contrib/com_err/com_err.c index f00c602..b6ad85b 100644 --- a/contrib/com_err/com_err.c +++ b/contrib/com_err/com_err.c @@ -34,7 +34,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> -RCSID("$Id: com_err.c,v 1.18 2002/03/10 23:07:01 assar Exp $"); +RCSID("$Id: com_err.c 14930 2005-04-24 19:43:06Z lha $"); #endif #include <stdio.h> #include <stdlib.h> @@ -51,15 +51,14 @@ error_message (long code) const char *p = com_right(_et_list, code); if (p == NULL) { if (code < 0) - sprintf(msg, "Unknown error %ld", code); + snprintf(msg, sizeof(msg), "Unknown error %ld", code); else p = strerror(code); } if (p != NULL && *p != '\0') { - strncpy(msg, p, sizeof(msg) - 1); - msg[sizeof(msg) - 1] = 0; + strlcpy(msg, p, sizeof(msg)); } else - sprintf(msg, "Unknown error %ld", code); + snprintf(msg, sizeof(msg), "Unknown error %ld", code); return msg; } |