summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/strerror/strerror_test.c
diff options
context:
space:
mode:
authorotto <>2005-05-08 06:34:25 +0000
committerotto <>2005-05-08 06:34:25 +0000
commitb99d6be9e154df69fe2f7a3e34e3d225cbbb9e61 (patch)
treed5fe05dcabf88821b83b21ee1c8a9feda9a294a4 /src/regress/lib/libc/strerror/strerror_test.c
parentb8b955315e0a9987501c1a8199d58da7a7853499 (diff)
downloadopenbsd-b99d6be9e154df69fe2f7a3e34e3d225cbbb9e61.tar.gz
openbsd-b99d6be9e154df69fe2f7a3e34e3d225cbbb9e61.tar.bz2
openbsd-b99d6be9e154df69fe2f7a3e34e3d225cbbb9e61.zip
Try to catch some more errors and adapt to slightly changed strerror.
Diffstat (limited to 'src/regress/lib/libc/strerror/strerror_test.c')
-rw-r--r--src/regress/lib/libc/strerror/strerror_test.c9
1 files changed, 5 insertions, 4 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 @@
1/* $OpenBSD: strerror_test.c,v 1.2 2004/05/02 22:34:29 espie Exp $ */ 1/* $OpenBSD: strerror_test.c,v 1.3 2005/05/08 06:34:25 otto Exp $ */
2/* 2/*
3 * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> 3 * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
4 * 4 *
@@ -22,14 +22,15 @@
22void 22void
23check_strerror_r(int val) 23check_strerror_r(int val)
24{ 24{
25 char buffer[NL_TEXTMAX]; 25 char buffer[NL_TEXTMAX + 1];
26 int i, r; 26 int i, r;
27 27
28 memset(buffer, 0, sizeof(buffer)); 28 memset(buffer, 'X', sizeof(buffer) - 1);
29 buffer[sizeof(buffer) - 1] = '\0';
29 (void)strerror_r(val, NULL, 0); /* XXX */ 30 (void)strerror_r(val, NULL, 0); /* XXX */
30 for (i = 0; i < 25; i++) { 31 for (i = 0; i < 25; i++) {
31 r = strerror_r(val, buffer, i); 32 r = strerror_r(val, buffer, i);
32 printf("%d %d %lu: %s\n", i, r, strlen(buffer), buffer); 33 printf("%d %d %zu: %s\n", i, r, strlen(buffer), buffer);
33 } 34 }
34} 35}
35 36