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