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 df519bc65edb788fcd14d69cc782613ac4c767b3..d9e6fc0458e9a5a241e027fd886e90a2fac7abc8 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 6e4aab7fe634ee9535de8f58bc0d40de559e64bc..af4b56cd406a27b5af33461e869b9b848a9c17a2 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 e74300220a8735880e19451be8bcbb01c3b53a5d..8bc9d46b9f1dee4a7081fc2a69531b2207e4ff76 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: