diff options
| author | beck <> | 2021-07-11 20:18:07 +0000 |
|---|---|---|
| committer | beck <> | 2021-07-11 20:18:07 +0000 |
| commit | 60e361c7ad4d3810a5c94e8def304ac4427b9c59 (patch) | |
| tree | 880e8f5861a3b885764099dac44578629840e2c8 /src/lib/libcrypto/man | |
| parent | 60ed74a03b493fb6ce651ecc0766dc98aa8175db (diff) | |
| download | openbsd-60e361c7ad4d3810a5c94e8def304ac4427b9c59.tar.gz openbsd-60e361c7ad4d3810a5c94e8def304ac4427b9c59.tar.bz2 openbsd-60e361c7ad4d3810a5c94e8def304ac4427b9c59.zip | |
While the traditional OpenSSL return value and behaviour of BIO_dump(3)
is pure comedy gold, and now documented as such, sadly this bit of pure
Muppet genius can't really in good consience stay in the tree as is.
Change BIO_dump to always return the number of bytes printed on success
and to stop printing and return -1 on failure if a writing function
fails.
ok tb@, jsing@
Diffstat (limited to 'src/lib/libcrypto/man')
| -rw-r--r-- | src/lib/libcrypto/man/BIO_dump.3 | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/src/lib/libcrypto/man/BIO_dump.3 b/src/lib/libcrypto/man/BIO_dump.3 index 88ae7d571d..1b66d95679 100644 --- a/src/lib/libcrypto/man/BIO_dump.3 +++ b/src/lib/libcrypto/man/BIO_dump.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BIO_dump.3,v 1.1 2021/07/10 15:56:18 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_dump.3,v 1.2 2021/07/11 20:18:07 beck Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: July 10 2021 $ | 17 | .Dd $Mdocdate: July 11 2021 $ |
| 18 | .Dt BIO_DUMP 3 | 18 | .Dt BIO_DUMP 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -98,24 +98,13 @@ are similar except that | |||
| 98 | is used instead of | 98 | is used instead of |
| 99 | .Xr BIO_write 3 . | 99 | .Xr BIO_write 3 . |
| 100 | .Sh RETURN VALUES | 100 | .Sh RETURN VALUES |
| 101 | These functions return the sum of the return values of all calls to | 101 | On success these functions return the total number of bytes written by |
| 102 | .Xr BIO_write 3 | 102 | .Xr BIO_write 3 |
| 103 | or | 103 | or |
| 104 | .Xr fwrite 3 | 104 | .Xr fwrite 3 . |
| 105 | that were made. | 105 | If a failure occurs at any point when writing, these |
| 106 | This is useless because it may add a positive number, the total amount | 106 | functions will stop after having potentially written out partial results, |
| 107 | of bytes written by successful calls to | 107 | and return -1. |
| 108 | .Xr BIO_write 3 , | ||
| 109 | to an incommensurable negative number, usually the number of calls to | ||
| 110 | .Xr BIO_write 3 | ||
| 111 | that failed. | ||
| 112 | All that can be said is that a negative return value indicates that | ||
| 113 | at least part of the printing failed, and a positive return value | ||
| 114 | indicates that at least some of the printing succeeded, but one | ||
| 115 | cannot tell whether success or failure were partial or complete. | ||
| 116 | Furthermore, a zero return value does not necessarily mean that | ||
| 117 | nothing was printed; it can also occur if a part of the printing | ||
| 118 | succeeded and another part failed. | ||
| 119 | .Sh SEE ALSO | 108 | .Sh SEE ALSO |
| 120 | .Xr hexdump 1 , | 109 | .Xr hexdump 1 , |
| 121 | .Xr BIO_new 3 , | 110 | .Xr BIO_new 3 , |
| @@ -134,11 +123,3 @@ and | |||
| 134 | .Fn BIO_dump_indent_fp | 123 | .Fn BIO_dump_indent_fp |
| 135 | first appeared in OpenSSL 0.9.8 and have been available since | 124 | first appeared in OpenSSL 0.9.8 and have been available since |
| 136 | .Ox 4.5 . | 125 | .Ox 4.5 . |
| 137 | .Sh BUGS | ||
| 138 | If some parts of the printing operations succeed | ||
| 139 | and some other parts fail, | ||
| 140 | .Fn BIO_dump | ||
| 141 | may silently yield incomplete results | ||
| 142 | such that the caller cannot detect the partial failure. | ||
| 143 | Besides, the function may have written more bytes than the return | ||
| 144 | value indicates. | ||
