From b99d6be9e154df69fe2f7a3e34e3d225cbbb9e61 Mon Sep 17 00:00:00 2001 From: otto <> Date: Sun, 8 May 2005 06:34:25 +0000 Subject: Try to catch some more errors and adapt to slightly changed strerror. --- src/regress/lib/libc/strerror/strerror_test.c | 9 +++--- src/regress/lib/libc/strerror/valid.ok | 44 +++++++++++++-------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/regress/lib/libc/strerror/strerror_test.c b/src/regress/lib/libc/strerror/strerror_test.c index 061cda6fc3..670f8c5616 100644 --- a/src/regress/lib/libc/strerror/strerror_test.c +++ b/src/regress/lib/libc/strerror/strerror_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strerror_test.c,v 1.2 2004/05/02 22:34:29 espie Exp $ */ +/* $OpenBSD: strerror_test.c,v 1.3 2005/05/08 06:34:25 otto Exp $ */ /* * Copyright (c) 2004 Marc Espie * @@ -22,14 +22,15 @@ void check_strerror_r(int val) { - char buffer[NL_TEXTMAX]; + char buffer[NL_TEXTMAX + 1]; int i, r; - memset(buffer, 0, sizeof(buffer)); + memset(buffer, 'X', sizeof(buffer) - 1); + buffer[sizeof(buffer) - 1] = '\0'; (void)strerror_r(val, NULL, 0); /* XXX */ for (i = 0; i < 25; i++) { r = strerror_r(val, buffer, i); - printf("%d %d %lu: %s\n", i, r, strlen(buffer), buffer); + printf("%d %d %zu: %s\n", i, r, strlen(buffer), buffer); } } diff --git a/src/regress/lib/libc/strerror/valid.ok b/src/regress/lib/libc/strerror/valid.ok index 9f7529e97e..d3061a1047 100644 --- a/src/regress/lib/libc/strerror/valid.ok +++ b/src/regress/lib/libc/strerror/valid.ok @@ -4,7 +4,7 @@ Undefined error: 0 Unknown error: 2147483647 Unknown error: -2147483648 Operation not permitted -0 34 0: +0 34 255: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 1 34 0: 2 34 1: O 3 34 2: Op @@ -29,27 +29,27 @@ Operation not permitted 22 34 21: Operation not permitt 23 34 22: Operation not permitte 24 0 23: Operation not permitted -0 22 0: -1 22 0: -2 22 1: U -3 22 2: Un -4 22 3: Unk -5 22 4: Unkn -6 22 5: Unkno -7 22 6: Unknow -8 22 7: Unknown -9 22 8: Unknown -10 22 9: Unknown e -11 22 10: Unknown er -12 22 11: Unknown err -13 22 12: Unknown erro -14 22 13: Unknown error -15 22 14: Unknown error: -16 22 15: Unknown error: -17 22 16: Unknown error: 2 -18 22 17: Unknown error: 21 -19 22 18: Unknown error: 213 -20 22 19: Unknown error: 2134 +0 34 255: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +1 34 0: +2 34 1: U +3 34 2: Un +4 34 3: Unk +5 34 4: Unkn +6 34 5: Unkno +7 34 6: Unknow +8 34 7: Unknown +9 34 8: Unknown +10 34 9: Unknown e +11 34 10: Unknown er +12 34 11: Unknown err +13 34 12: Unknown erro +14 34 13: Unknown error +15 34 14: Unknown error: +16 34 15: Unknown error: +17 34 15: Unknown error: +18 34 15: Unknown error: +19 34 15: Unknown error: +20 34 15: Unknown error: 21 22 20: Unknown error: 21345 22 22 20: Unknown error: 21345 23 22 20: Unknown error: 21345 -- cgit v1.2.3-55-g6feb