From 262aee277f2082ea7841e6eb918cb0e689786ce2 Mon Sep 17 00:00:00 2001 From: "wtchang%redhat.com" Date: Tue, 25 Jan 2005 19:40:56 +0000 Subject: [PATCH] Bugzilla Bug 279723: PR_ReadDir needs to map the error code before returning with a failure. The patch is contributed by Mathieu Poumeyrol . r=wtc. --- nsprpub/pr/src/pthreads/ptio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nsprpub/pr/src/pthreads/ptio.c b/nsprpub/pr/src/pthreads/ptio.c index 3a87657174a..a4ffb6fec17 100644 --- a/nsprpub/pr/src/pthreads/ptio.c +++ b/nsprpub/pr/src/pthreads/ptio.c @@ -4300,7 +4300,11 @@ PR_IMPLEMENT(PRDirEntry*) PR_ReadDir(PRDir *dir, PRDirFlags flags) for (;;) { dp = readdir(dir->md.d); - if (NULL == dp) return NULL; + if (NULL == dp) + { + pt_MapError(_PR_MD_MAP_READDIR_ERROR, errno); + return NULL; + } if ((flags & PR_SKIP_DOT) && ('.' == dp->d_name[0]) && (0 == dp->d_name[1])) continue; @@ -4347,8 +4351,8 @@ PR_IMPLEMENT(PRStatus) PR_NewTCPSocketPair(PRFileDesc *fds[2]) if (pt_TestAbort()) return PR_FAILURE; if (socketpair(AF_UNIX, SOCK_STREAM, 0, osfd) == -1) { - pt_MapError(_PR_MD_MAP_SOCKETPAIR_ERROR, errno); - return PR_FAILURE; + pt_MapError(_PR_MD_MAP_SOCKETPAIR_ERROR, errno); + return PR_FAILURE; } fds[0] = pt_SetMethods(osfd[0], PR_DESC_SOCKET_TCP, PR_FALSE, PR_FALSE);