Align BIO_get_fd with upstream.
OpenSSL's BIO_get_fd returns the fd or -1, not a boolean. Change-Id: I12a3429c71bb9c9064f9f91329a88923025f1fb5 Reviewed-on: https://boringssl-review.googlesource.com/6080 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
c7ce977fb9
commit
617eac6a21
@ -445,9 +445,9 @@ static long conn_ctrl(BIO *bio, int cmd, long num, void *ptr) {
|
||||
if (ip != NULL) {
|
||||
*ip = bio->num;
|
||||
}
|
||||
ret = 1;
|
||||
ret = bio->num;
|
||||
} else {
|
||||
ret = 0;
|
||||
ret = -1;
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_GET_CLOSE:
|
||||
|
@ -208,9 +208,9 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr) {
|
||||
if (ip != NULL) {
|
||||
*ip = b->num;
|
||||
}
|
||||
return 1;
|
||||
return b->num;
|
||||
} else {
|
||||
ret = 0;
|
||||
ret = -1;
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_GET_CLOSE:
|
||||
|
@ -444,8 +444,9 @@ OPENSSL_EXPORT BIO *BIO_new_fd(int fd, int close_flag);
|
||||
* or zero on error. */
|
||||
OPENSSL_EXPORT int BIO_set_fd(BIO *bio, int fd, int close_flag);
|
||||
|
||||
/* BIO_get_fd sets |*out_fd| to the file descriptor currently in use by |bio|.
|
||||
* It returns one on success and zero on error. */
|
||||
/* BIO_get_fd returns the file descriptor currently in use by |bio| or -1 if
|
||||
* |bio| does not wrap a file descriptor. If there is a file descriptor and
|
||||
* |out_fd| is not NULL, it also sets |*out_fd| to the file descriptor. */
|
||||
OPENSSL_EXPORT int BIO_get_fd(BIO *bio, int *out_fd);
|
||||
|
||||
|
||||
|
@ -1121,7 +1121,7 @@ int SSL_set_wfd(SSL *s, int fd) {
|
||||
BIO *bio = NULL;
|
||||
|
||||
if (s->rbio == NULL || BIO_method_type(s->rbio) != BIO_TYPE_FD ||
|
||||
(int)BIO_get_fd(s->rbio, NULL) != fd) {
|
||||
BIO_get_fd(s->rbio, NULL) != fd) {
|
||||
bio = BIO_new(BIO_s_fd());
|
||||
|
||||
if (bio == NULL) {
|
||||
@ -1145,7 +1145,7 @@ int SSL_set_rfd(SSL *s, int fd) {
|
||||
BIO *bio = NULL;
|
||||
|
||||
if (s->wbio == NULL || BIO_method_type(s->wbio) != BIO_TYPE_FD ||
|
||||
(int)BIO_get_fd(s->wbio, NULL) != fd) {
|
||||
BIO_get_fd(s->wbio, NULL) != fd) {
|
||||
bio = BIO_new(BIO_s_fd());
|
||||
|
||||
if (bio == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user