Closed
Bug 276587
Opened 20 years ago
Closed 20 years ago
[BeOS] bfile.c still uses the broken access function for _MD_access
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
4.6
People
(Reporter: thesuckiestemail, Assigned: thesuckiestemail)
References
Details
Attachments
(1 file, 2 obsolete files)
|
1.16 KB,
patch
|
thesuckiestemail
:
review+
|
Details | Diff | Splinter Review |
See https://bugzilla.mozilla.org/show_bug.cgi?id=169506#c0 for info.
Here is a rewrite sort of like in bug 169506.
Comment 2•20 years ago
|
||
Comment on attachment 169976 [details] [diff] [review] Using stat() instead >+ //If stat doesn't return error we should never set rv to -1, so st_mode & checkFlags must be > 0. Please use C-style comment delimiters /* ... */ and wrap this long line. Is it possible for a file to have a buf.st_mode of 0? If so, we'll need to handle PR_ACCESS_EXISTS as a special case without using checkFlags. I think it's safer to do that anyway. >+ rv = stat(name, &buf); >+ if(rv==0 && ( !(buf.st_mode & checkFlags))) >+ rv = -1; > > if (rv < 0) { > err = _MD_ERRNO(); > _PR_MD_MAP_ACCESS_ERROR(err); > } We should use _PR_MD_MAP_STAT_ERROR instead of _PR_MD_MAP_ACCESS_ERROR. If we set rv to -1 artificially, we can't use errno because the stat() call succeeded. So we will need to also set the error code artificially. This means the code should read: rv = stat(name, &buf); if (rv==0 && ( !(buf.st_mode & checkFlags))) { PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, 0); return -1; }
Attachment #169976 -
Flags: review-
Comment 3•20 years ago
|
||
This is what I meant. Please review and test this patch.
Attachment #169976 -
Attachment is obsolete: true
Attachment #170187 -
Flags: review?(thesuckiestemail)
Except that it had bad EOL characters, it looks ok. Uploading the same patch but without \r.
Attachment #170187 -
Attachment is obsolete: true
Attachment #170650 -
Flags: review+
Comment on attachment 170187 [details] [diff] [review] Using stat() instead, v2 Removing obsolete review.
Attachment #170187 -
Flags: review?(thesuckiestemail)
Comment 6•20 years ago
|
||
I checked in the patch on the NSPR tip (NSPR 4.6) and NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.8 Beta).
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.6
You need to log in
before you can comment on or make changes to this bug.
Description
•