Mercurial > hg > octave-nkf > gnulib-hg
changeset 15307:eaa30c92de91
perror: adjust array size
If we ever adjust strerror-override.h to have a larger size for
STACKBUF_LEN, then perror should also pick up the adjustment.
* modules/perror (Depends-on): Add strerror-override.
* lib/perror.c (perror): Use it to avoid magic number.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Tue, 21 Jun 2011 10:10:06 -0600 |
parents | 5cac42931c47 |
children | a3ba680ad389 |
files | ChangeLog lib/perror.c modules/perror |
diffstat | 3 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-06-21 Eric Blake <eblake@redhat.com> + perror: adjust array size + * modules/perror (Depends-on): Add strerror-override. + * lib/perror.c (perror): Use it to avoid magic number. + strerror-override: reduce size * lib/strerror-override.c (strerror_override): Use fewer lines.
--- a/lib/perror.c +++ b/lib/perror.c @@ -24,13 +24,15 @@ #include <stdlib.h> #include <string.h> +#include "strerror-override.h" + /* Use the system functions, not the gnulib overrides in this file. */ #undef fprintf void perror (const char *string) { - char stackbuf[256]; + char stackbuf[STACKBUF_LEN]; int ret; /* Our implementation guarantees that this will be a non-empty