BIO_eof() and OSSL_STORE_eof(): Make sure to return 1 on error; improve related doc
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Mon, 26 Apr 2021 12:55:18 +0000 (14:55 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Tue, 4 May 2021 16:16:56 +0000 (18:16 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15029)

crypto/store/store_lib.c
doc/man3/BIO_ctrl.pod
doc/man3/OSSL_STORE_open.pod

index 2c7c9f32267411013f4b08ba21af109832a1a499..e7f586060421004f1fe196f18be945c1139c42a8 100644 (file)
@@ -463,7 +463,7 @@ int OSSL_STORE_eof(OSSL_STORE_CTX *ctx)
     if (ctx->fetched_loader == NULL)
         ret = ctx->loader->eof(ctx->loader_ctx);
 #endif
-    return ret;
+    return ret != 0;
 }
 
 static int ossl_store_close_it(OSSL_STORE_CTX *ctx)
index 328382d7c996c9124827f3e76f5a9b6ef9f720f3..b3108f83ef52004ee008158df7b95a8bf4437893 100644 (file)
@@ -92,7 +92,7 @@ for success and -1 for failure.
 
 BIO_flush() returns 1 for success and 0 or -1 for failure.
 
-BIO_eof() returns 1 if EOF has been reached 0 otherwise.
+BIO_eof() returns 1 if EOF has been reached, 0 if not, or -1 for failure.
 
 BIO_set_close() always returns 1.
 
index 61571be490cacf50729f9b6310369a925b4778bb..3d6d03a990f16340ceba5046b73fb5ad806f719b 100644 (file)
@@ -143,8 +143,8 @@ on error or when end of data is reached.
 Use OSSL_STORE_error() and OSSL_STORE_eof() to determine the meaning of a
 returned NULL.
 
-OSSL_STORE_eof() returns 1 if the end of data has been reached, otherwise
-0.
+OSSL_STORE_eof() returns 1 if the end of data has been reached
+or an error occurred, 0 otherwise.
 
 OSSL_STORE_error() returns 1 if an error occurred in an OSSL_STORE_load() call,
 otherwise 0.