[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/8] split: don't rely on knowledge that INT_BUFSIZE_BOUND <= SIG
From: |
Jim Meyering |
Subject: |
[PATCH 7/8] split: don't rely on knowledge that INT_BUFSIZE_BOUND <= SIG2STR_MAX |
Date: |
Sat, 30 Apr 2011 15:31:08 +0200 |
From: Jim Meyering <address@hidden>
* src/split.c (closeout): SIG2STR_MAX is a buffer size, so there's
no need to add 1. However, since we may also write the decimal
representation of an "int" into this same buffer, include
INT_BUFSIZE_BOUND in the equation.
---
src/split.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/split.c b/src/split.c
index bd63fcf..66f44fc 100644
--- a/src/split.c
+++ b/src/split.c
@@ -372,7 +372,7 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name)
int sig = WTERMSIG (wstatus);
if (sig != SIGPIPE)
{
- char signame[SIG2STR_MAX+1];
+ char signame[MAX (SIG2STR_MAX, INT_BUFSIZE_BOUND (int))];
if (sig2str (sig, signame) != 0)
sprintf (signame, "%d", sig);
error (sig + 128, 0,
--
1.7.5.134.g1c08b
- split --filter, nearly ready, Jim Meyering, 2011/04/30
- [PATCH 4/8] split: update NEWS, Jim Meyering, 2011/04/30
- [PATCH 7/8] split: don't rely on knowledge that INT_BUFSIZE_BOUND <= SIG2STR_MAX,
Jim Meyering <=
- [PATCH 3/8] split: add tests, Jim Meyering, 2011/04/30
- [PATCH 6/8] strip: style: use braces around 1-stmt-but-multi-line blocks, Jim Meyering, 2011/04/30
- [PATCH 2/8] split: remove short-named -f option; improve diagnostics, Jim Meyering, 2011/04/30
- [PATCH 5/8] split: mark a string for translation, Jim Meyering, 2011/04/30
- [PATCH 8/8] doc: document split's new --filter=CMD option, Jim Meyering, 2011/04/30