From 4b0b1b4767b312a2b03225ea08f07992f4823036 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Thu, 27 Dec 2001 02:19:31 +0000 Subject: [PATCH] Bugzilla bug 110868: PR_FileDesc2NativeHandle should look for the NSPR layer as opposed to assuming the bottom layer is the NSPR layer. --- nsprpub/pr/src/io/prsocket.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/nsprpub/pr/src/io/prsocket.c b/nsprpub/pr/src/io/prsocket.c index 2483f9637a7f..e6eacaa13910 100644 --- a/nsprpub/pr/src/io/prsocket.c +++ b/nsprpub/pr/src/io/prsocket.c @@ -1539,20 +1539,14 @@ failed: PR_IMPLEMENT(PRInt32) PR_FileDesc2NativeHandle(PRFileDesc *fd) { - if (fd) { - /* - * The fd may be layered. Chase the links to the - * bottom layer to get the osfd. - */ - PRFileDesc *bottom = fd; - while (bottom->lower != NULL) { - bottom = bottom->lower; - } - return bottom->secret->md.osfd; - } else { - PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); - return -1; - } + if (fd) { + fd = PR_GetIdentitiesLayer(fd, PR_NSPR_IO_LAYER); + } + if (!fd) { + PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); + return -1; + } + return fd->secret->md.osfd; } PR_IMPLEMENT(void)