[BeOS] bfile.c still uses the broken access function for _MD_access

RESOLVED FIXED in 4.6

Status

defect
RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: thesuckiestemail, Assigned: thesuckiestemail)

Tracking

other
Other
BeOS
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

Assignee

Comment 1

15 years ago
Posted patch Using stat() instead (obsolete) — Splinter Review
Here is a rewrite sort of like in bug 169506.
Assignee

Updated

15 years ago
Assignee: wtchang → thesuckiestemail
Status: NEW → ASSIGNED
Assignee

Updated

15 years ago
Blocks: 266252

Comment 2

15 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

15 years ago
Posted patch Using stat() instead, v2 (obsolete) — Splinter Review
This is what I meant.  Please review and test this patch.
Attachment #169976 - Attachment is obsolete: true
Attachment #170187 - Flags: review?(thesuckiestemail)
Assignee

Comment 4

15 years ago
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+
Assignee

Comment 5

15 years ago
Comment on attachment 170187 [details] [diff] [review]
Using stat() instead, v2

Removing obsolete review.
Attachment #170187 - Flags: review?(thesuckiestemail)

Comment 6

15 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: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.6
You need to log in before you can comment on or make changes to this bug.