diff options
| author | guenther <> | 2014-07-20 01:38:40 +0000 |
|---|---|---|
| committer | guenther <> | 2014-07-20 01:38:40 +0000 |
| commit | 1cf6dac402bf6b677a14fb33c54ee0fcb4021bee (patch) | |
| tree | 5e6c4eae816d1f4766599fa8e5f8fea5d7d1a35e /src/regress/lib/libc/stdio_threading/fwrite | |
| parent | 137c95377460c8ff91a5fd5101d88c29c9211dd6 (diff) | |
| download | openbsd-1cf6dac402bf6b677a14fb33c54ee0fcb4021bee.tar.gz openbsd-1cf6dac402bf6b677a14fb33c54ee0fcb4021bee.tar.bz2 openbsd-1cf6dac402bf6b677a14fb33c54ee0fcb4021bee.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/fwrite')
| -rwxr-xr-x | src/regress/lib/libc/stdio_threading/fwrite/fwrite_test.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/regress/lib/libc/stdio_threading/fwrite/fwrite_test.c b/src/regress/lib/libc/stdio_threading/fwrite/fwrite_test.c index 621c5cb6e8..86c450cbc9 100755 --- a/src/regress/lib/libc/stdio_threading/fwrite/fwrite_test.c +++ b/src/regress/lib/libc/stdio_threading/fwrite/fwrite_test.c | |||
| @@ -46,11 +46,12 @@ main(void) | |||
| 46 | strlcpy(sfn, "/tmp/barnacles.XXXXXXXX", sizeof(sfn)); | 46 | strlcpy(sfn, "/tmp/barnacles.XXXXXXXX", sizeof(sfn)); |
| 47 | if ((fd = mkstemp(sfn)) == -1 || | 47 | if ((fd = mkstemp(sfn)) == -1 || |
| 48 | (sfp = fdopen(fd, "w+")) == NULL) { | 48 | (sfp = fdopen(fd, "w+")) == NULL) { |
| 49 | int saved_errno = errno; | ||
| 49 | if (fd != -1) { | 50 | if (fd != -1) { |
| 50 | unlink(sfn); | 51 | unlink(sfn); |
| 51 | close(fd); | 52 | close(fd); |
| 52 | } | 53 | } |
| 53 | err(1, "could not open temporary file"); | 54 | errc(1, saved_errno, "could not open temporary file"); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | run_threads(fwrite_thread, sfp); | 57 | run_threads(fwrite_thread, sfp); |
