Closed
Bug 142345
Opened 22 years ago
Closed 22 years ago
Wrong code fragments in mozilla/nsprbub/pr/src/md/uxshm.c
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
4.2.2
People
(Reporter: vgolitsin, Assigned: wtc)
References
Details
Attachments
(1 file)
920 bytes,
patch
|
Details | Diff | Splinter Review |
The file contains the following code fragment (routine _MD_OpenSharedMemory, lines 114-122): int osfd = open( shm->ipcname, (O_RDWR | O_CREAT), shm->mode ); if ( -1 == osfd ) { _PR_MD_MAP_OPEN_ERROR( errno ); PR_FREEIF( shm->ipcname ); PR_DELETE( shm ); return( NULL ); } if ( close(osfd == -1 )) { _PR_MD_MAP_CLOSE_ERROR( errno ); The line if ( close(osfd == -1 )) { is due to a obevious mistake... The same is repeated in _MD_CloseSharedMemory, the line 247. Even if the code is recently not used by Mozilla it worth to be fixed anyway. NOTE. I found the error just reviewing the code. It affects the paltforms supporting shared memory in the System V way (e.g. Sun).
Assignee | ||
Comment 1•22 years ago
|
||
Assignee | ||
Comment 2•22 years ago
|
||
Thanks for the bug report. You are right. I checked in the fix you suggested into the tip of NSPR. With the original code, we would close the Unix file descriptor 0 (because osfd is not equal to -1). close(0) would succeed in most processes (fd 0 is the standard input) and return 0, so the body of the if statement is not executed. This is why we have not noticed this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.2.1
Assignee | ||
Updated•22 years ago
|
Target Milestone: 4.2.1 → 4.2.2
Assignee | ||
Comment 3•22 years ago
|
||
*** Bug 172910 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•