Re: Determining if a file is located in the trash from a daemon problem - Getting nsvErr
Re: Determining if a file is located in the trash from a daemon problem - Getting nsvErr
- Subject: Re: Determining if a file is located in the trash from a daemon problem - Getting nsvErr
- From: Quinn <email@hidden>
- Date: Mon, 21 Sep 2009 10:22:17 +0100
At 16:21 -0400 18/9/09, Jean-Francois Dontigny wrote:
Can anyone explain why I keep getting the nsvErr?
As far as I can tell FSDetermineIfRefIsEnclosedByFolder can never
return noErr without also setting *outResult to true. That is, if an
item is not in the trash, a function result of nsvErr is the expected
behaviour. Our internal clients always call it like this:
isInTrash = (FSDetermineIfRefIsEnclosedByFolder(... , &result) == noErr)
&& result;
btw This non-obvious (and somewhat annoying IMO) behaviour is not
described in the documentation for the routine. I'd appreciate if
you could file a bug against the documentation.
<http://developer.apple.com/bugreporter/>
The above explains one aspect of the problem you're seeing. However...
Is it possible that I cannot use this function as root? (the code is
running inside a daemon)
What do you expect to happen in this case? Keep in mind that each
user has a separate trash. From the logs you posted, it looks like
you want it to test whether the item is any user's trash. That's not
the routine does. It tests whether the item is in a /specific/
user's trash. If you call it as root, you're testing against root's
trash (which is "/private/var/root/.Trash" on my system).
What's the high-level goal here? Doing a file system test like this
from a root process seems like a guaranteed TOC-TOU security bug in
the making.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden