From: olszomal Date: Fri, 8 Aug 2025 10:06:36 +0000 (+0200) Subject: apps: adjust stat usage to account for uplink X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d2a9af2144ac2938619e44af3eaeaed3ea49cb05;p=thirdparty%2Fopenssl.git apps: adjust stat usage to account for uplink Call stat() instead of fstat() when the FILE pointer provided by BIO_get_fp() is unavailable (as it may be the case in case of UPLINK builds). Signed-off-by: olszomal Reviewed-by: Dmitry Belyavskiy Reviewed-by: Eugene Syromiatnikov MergeDate: Wed Jul 8 09:47:42 2026 (Merged from https://github.com/openssl/openssl/pull/28172) --- diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 2c55c0af21e..128c40d0869 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -1849,11 +1849,18 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr) goto err; #ifndef OPENSSL_NO_POSIX_IO - BIO_get_fp(in, &dbfp); - if (fstat(fileno(dbfp), &dbst) == -1) { - ERR_raise_data(ERR_LIB_SYS, errno, - "calling fstat(%s)", dbfile); - goto err; + if (BIO_get_fp(in, &dbfp) > 0 && dbfp != NULL) { + if (fstat(fileno(dbfp), &dbst) == -1) { + ERR_raise_data(ERR_LIB_SYS, errno, + "calling fstat(%s)", dbfile); + goto err; + } + } else { + if (stat(dbfile, &dbst) == -1) { + ERR_raise_data(ERR_LIB_SYS, errno, + "calling stat(%s)", dbfile); + goto err; + } } #endif