diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-11-13 10:51:14 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-11-13 23:19:05 +1100 |
commit | 4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608 (patch) | |
tree | ca189d440b0a298cdcb3769d994828508dcd2e76 /source4/heimdal/lib/com_err/error.c | |
parent | 5bc87c14a1f5b45ed86e7ff9663f5f0aa2f70094 (diff) | |
download | samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.tar.gz samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.tar.bz2 samba-4f8ba5ad6ac9b7153b0e13654e59f47e67b3f608.zip |
s4:heimdal: import lorikeet-heimdal-200911122202 (commit 9291fd2d101f3eecec550178634faa94ead3e9a1)
Diffstat (limited to 'source4/heimdal/lib/com_err/error.c')
-rw-r--r-- | source4/heimdal/lib/com_err/error.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source4/heimdal/lib/com_err/error.c b/source4/heimdal/lib/com_err/error.c index 6b12c00c7a..d4a42ac5de 100644 --- a/source4/heimdal/lib/com_err/error.c +++ b/source4/heimdal/lib/com_err/error.c @@ -49,16 +49,26 @@ const char * com_right(struct et_list *list, long code) { struct et_list *p; + for (p = list; p; p = p->next) + if (code >= p->table->base && code < p->table->base + p->table->n_msgs) + return p->table->msgs[code - p->table->base]; + return NULL; +} + +const char * +com_right_r(struct et_list *list, long code, char *str, size_t len) +{ + struct et_list *p; for (p = list; p; p = p->next) { if (code >= p->table->base && code < p->table->base + p->table->n_msgs) { - const char *str = p->table->msgs[code - p->table->base]; + const char *msg = p->table->msgs[code - p->table->base]; #ifdef LIBINTL char domain[12 + 20]; snprintf(domain, sizeof(domain), "heim_com_err%d", p->table->base); #endif - return dgettext(domain, str); + strlcpy(str, dgettext(domain, msg), len); + return str; } - } return NULL; } |