Fix issues in nickm's review of format_helper_exit_status for bug #1903

- Responsibility of clearing hex_errno is no longer with caller
- More conservative bounds checking
- Length requirement of hex_errno documented
- Output format documented
This commit is contained in:
Steven Murdoch
2010-10-04 14:14:11 +01:00
parent 80b515b85f
commit 5a77c64834
2 changed files with 35 additions and 14 deletions
+2 -3
View File
@@ -1212,14 +1212,13 @@ test_util_load_win_lib(void *ptr)
static void
clear_hex_errno(char *hex_errno)
{
memset(hex_errno, ' ', HEX_ERRNO_SIZE - 2);
hex_errno[HEX_ERRNO_SIZE - 1] = '\n';
hex_errno[HEX_ERRNO_SIZE] = '\0';
memset(hex_errno, '\0', HEX_ERRNO_SIZE + 1);
}
static void
test_util_exit_status(void *ptr)
{
/* Leave an extra byte for a \0 so we can do string comparison */
char hex_errno[HEX_ERRNO_SIZE + 1];
(void)ptr;