Closed Bug 92294 Opened 24 years ago Closed 24 years ago

nsIFile IsDirectory doesn't handle symlinks [FIX][REVIEW]

Categories

(Core :: XPCOM, defect, P1)

Other
FreeBSD
defect

Tracking

()

RESOLVED INVALID
mozilla0.9.4

People

(Reporter: pete, Assigned: pete)

Details

Attachments

(4 files)

Assigning to myself, i have a fix for this in my local tree. --pete
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch FixSplinter Review
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.4
Keywords: patch, review
Summary: nsIFile IsDirectory doesn't handle symlinks → nsIFile IsDirectory doesn't handle symlinks [FIX][REVIEW]
You need to give this code some nsCOMPtr love, this will leak 'target' in case target->InitWithPath() or any other calls before the NS_RELEASE(target) fails: + nsLocalFile *target = new nsLocalFile(); + if (!target) + return NS_ERROR_OUT_OF_MEMORY; + NS_ADDREF(target); + if (NS_FAILED(rv=target->InitWithPath(symPath))) + return rv; Change that and I'll have one more look.
> You need to give this code some nsCOMPtr love, this will leak 'target' Duh, Don't knwo why i did that . . . Anyway, fixed. Thanks Johnny. --pete
Priority: -- → P1
I don't get it -- why is this bug's patch code necessary? nsLocalFileUnix.h's nsLocalFile::FillStatCache calls stat(2), which follows symlinks. There should be no need to get the target, worry about whether it exists, etc. Is this bug about nsLocalFileWin.cpp or Mac bugs not found on Unix? /be
Brendan, you are right. However, yesterday isDirectory was not working properly. It was returning false when checking a symlinked dir . . . Today it is . . . ? I have to see if i can duplicate what I was seeing yesterday. This is strange. --pete
I'm going to mark this one invalid. I can't seem to repeat what i was seeing the other day. I will reopen if i stumble across this again. --pete
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
*** Bug 192809 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.

Attachment

General

Created:
Updated:
Size: