diff options
| author | guenther <> | 2014-07-20 01:38:40 +0000 |
|---|---|---|
| committer | guenther <> | 2014-07-20 01:38:40 +0000 |
| commit | de21c6ec21e1a745fd5d9c4878218fb4d07f0737 (patch) | |
| tree | 5e6c4eae816d1f4766599fa8e5f8fea5d7d1a35e /src/regress/lib/libc/stdio_threading/fgets | |
| parent | 61b0982e8e00b9d378695b1873b5409afd7d7b96 (diff) | |
| download | openbsd-de21c6ec21e1a745fd5d9c4878218fb4d07f0737.tar.gz openbsd-de21c6ec21e1a745fd5d9c4878218fb4d07f0737.tar.bz2 openbsd-de21c6ec21e1a745fd5d9c4878218fb4d07f0737.zip | |
Make sure the correct errno is reported by warn* or err* and not
the errno of an intervening cleanup operation like close/unlink/etc.
Diff from Doug Hogan (doug (at) acyclic.org)
Diffstat (limited to 'src/regress/lib/libc/stdio_threading/fgets')
| -rwxr-xr-x | src/regress/lib/libc/stdio_threading/fgets/fgets_test.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/regress/lib/libc/stdio_threading/fgets/fgets_test.c b/src/regress/lib/libc/stdio_threading/fgets/fgets_test.c index c53abbc06b..7c5008e2ad 100755 --- a/src/regress/lib/libc/stdio_threading/fgets/fgets_test.c +++ b/src/regress/lib/libc/stdio_threading/fgets/fgets_test.c | |||
| @@ -48,11 +48,12 @@ main(void) | |||
| 48 | strlcpy(sfn, "/tmp/barnacles.XXXXXXXX", sizeof(sfn)); | 48 | strlcpy(sfn, "/tmp/barnacles.XXXXXXXX", sizeof(sfn)); |
| 49 | if ((fd = mkstemp(sfn)) == -1 || | 49 | if ((fd = mkstemp(sfn)) == -1 || |
| 50 | (sfp = fdopen(fd, "w+")) == NULL) { | 50 | (sfp = fdopen(fd, "w+")) == NULL) { |
| 51 | int saved_errno = errno; | ||
| 51 | if (fd != -1) { | 52 | if (fd != -1) { |
| 52 | unlink(sfn); | 53 | unlink(sfn); |
| 53 | close(fd); | 54 | close(fd); |
| 54 | } | 55 | } |
| 55 | err(1, "could not open temporary file"); | 56 | errc(1, saved_errno, "could not open temporary file"); |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | for (i = 0; i < 4096 * THREAD_COUNT; i++) | 59 | for (i = 0; i < 4096 * THREAD_COUNT; i++) |
