Skip to content

Commit dfbc6b0

Browse files
committed
get rid of goto
1 parent fd61270 commit dfbc6b0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ext/openssl/openssl.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,22 +1567,16 @@ PHP_FUNCTION(openssl_x509_export_to_file)
15671567

15681568
bio_out = BIO_new_file(file_path, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
15691569
if (bio_out) {
1570-
if (!notext && !X509_print(bio_out, cert)) {
1571-
php_openssl_store_errors();
1572-
goto exit_cleanup_bio;
1573-
}
1574-
if (!PEM_write_bio_X509(bio_out, cert)) {
1570+
if ((notext || X509_print(bio_out, cert)) && PEM_write_bio_X509(bio_out, cert)) {
1571+
RETVAL_TRUE;
1572+
} else {
15751573
php_openssl_store_errors();
1576-
goto exit_cleanup_bio;
15771574
}
1578-
1579-
RETVAL_TRUE;
15801575
} else {
15811576
php_openssl_store_errors();
15821577
php_error_docref(NULL, E_WARNING, "Error opening file %s", file_path);
15831578
}
15841579

1585-
exit_cleanup_bio:
15861580
if (!BIO_free(bio_out)) {
15871581
php_openssl_store_errors();
15881582
}

0 commit comments

Comments
 (0)