perror: adjust array size
authorEric Blake <eblake@redhat.com>
Tue, 21 Jun 2011 16:10:06 +0000 (10:10 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 21 Jun 2011 16:15:45 +0000 (10:15 -0600)
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>
ChangeLog
lib/perror.c
modules/perror

index df519bc..d9e6fc0 100644 (file)
--- 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.
 
index 6e4aab7..af4b56c 100644 (file)
 #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
index e743002..8bc9d46 100644 (file)
@@ -8,6 +8,7 @@ m4/perror.m4
 Depends-on:
 stdio
 errno            [test $REPLACE_PERROR = 1]
+strerror-override [test $REPLACE_PERROR = 1]
 strerror_r-posix [test $REPLACE_PERROR = 1]
 
 configure.ac: