Add support for shared libraries with OS/2.
[oweals/openssl.git] / crypto / pem / pem_info.c
index 7fc5e5c4c0c83e9c24d7006a9410218688a741cd..27bcc25177539821d12c1616da341e269a0a56e6 100644 (file)
@@ -111,7 +111,7 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pe
                i=PEM_read_bio(bp,&name,&header,&data,&len);
                if (i == 0)
                        {
-                       error=ERR_GET_REASON(ERR_peek_error());
+                       error=ERR_GET_REASON(ERR_peek_last_error());
                        if (error == PEM_R_NO_START_LINE)
                                {
                                ERR_clear_error();
@@ -370,7 +370,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
                }
 
        /* if we have a certificate then write it out now */
-       if ((xi->x509 != NULL) || (PEM_write_bio_X509(bp,xi->x509) <= 0))
+       if ((xi->x509 != NULL) && (PEM_write_bio_X509(bp,xi->x509) <= 0))
                goto err;
 
        /* we are ignoring anything else that is loaded into the X509_INFO