summaryrefslogtreecommitdiffstats
path: root/contrib/com_err/com_err.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2008-05-08 11:01:46 +0000
committerdfr <dfr@FreeBSD.org>2008-05-08 11:01:46 +0000
commit62929665b739d66740a668830f004f9463f3ced9 (patch)
tree29031943aed09b2fbdbdc248e2868d86477d1ea3 /contrib/com_err/com_err.c
parente240fee79046f8dbba1a0ff52d7d6d7db5d9ecf4 (diff)
downloadFreeBSD-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.c9
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;
}
OpenPOWER on IntegriCloud