[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] perror: adjust array size
From: |
Eric Blake |
Subject: |
[PATCH 2/2] perror: adjust array size |
Date: |
Tue, 21 Jun 2011 10:14:49 -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 <address@hidden>
---
I'm pushing these two cleanups. This change shouldn't add any more
files to perror, since strerror-override.h was already being
implicitly pulled in by the strerror_r-posix dependency.
ChangeLog | 6 ++++++
lib/perror.c | 4 +++-
modules/perror | 1 +
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index df519bc..2b04c66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2011-06-21 Eric Blake <address@hidden>
+ perror: adjust array size
+ * modules/perror (Depends-on): Add strerror-override.
+ * lib/perror.c (perror): Use it to avoid magic number.
+
+2011-06-21 Eric Blake <address@hidden>
+
strerror-override: reduce size
* lib/strerror-override.c (strerror_override): Use fewer lines.
diff --git a/lib/perror.c b/lib/perror.c
index 6e4aab7..af4b56c 100644
--- 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
diff --git a/modules/perror b/modules/perror
index e743002..8bc9d46 100644
--- a/modules/perror
+++ b/modules/perror
@@ -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:
--
1.7.4.4