Commit 8c7e3f217c for openssl.org
commit 8c7e3f217cf104fb3bbfc903e5619c17e79b8393
Author: olszomal <Malgorzata.Olszowka@stunnel.org>
Date: Wed Jul 8 11:42:37 2026 +0200
apps/ocsp.c: guard index_changed() with OPENSSL_NO_POSIX_IO, not HTTP_DAEMON
Replace #ifdef HTTP_DAEMON with #ifndef OPENSSL_NO_POSIX_IO for code
that only requires POSIX {,f}stat(), improving portability.
Retain syslog() call only when HTTP_DAEMON is defined, use
BIO_printf(bio_err) otherwise.
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul 8 09:47:43 2026
(Merged from https://github.com/openssl/openssl/pull/28172)
diff --git a/apps/ocsp.c b/apps/ocsp.c
index 2293185daf..59d33e90f2 100644
--- a/apps/ocsp.c
+++ b/apps/ocsp.c
@@ -74,7 +74,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio,
static int send_ocsp_response(BIO *cbio, const OCSP_RESPONSE *resp);
static char *prog;
-#ifdef HTTP_DAEMON
+#ifndef OPENSSL_NO_POSIX_IO
static int index_changed(CA_DB *);
#endif
@@ -680,7 +680,7 @@ int ocsp_main(int argc, char **argv)
redo_accept:
if (acbio != NULL) {
-#ifdef HTTP_DAEMON
+#ifndef OPENSSL_NO_POSIX_IO
if (index_changed(rdb)) {
CA_DB *newrdb = load_index(ridx_filename, NULL);
@@ -926,7 +926,7 @@ end:
return ret;
}
-#ifdef HTTP_DAEMON
+#ifndef OPENSSL_NO_POSIX_IO
static int index_changed(CA_DB *rdb)
{
@@ -937,7 +937,11 @@ static int index_changed(CA_DB *rdb)
|| rdb->dbst.st_ctime != sb.st_ctime
|| rdb->dbst.st_ino != sb.st_ino
|| rdb->dbst.st_dev != sb.st_dev) {
+#ifdef HTTP_DAEMON
syslog(LOG_INFO, "index file changed, reloading");
+#else
+ BIO_printf(bio_err, "%s: index file changed, reloading\n", prog);
+#endif
return 1;
}
}