bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] find: add SELinux support


From: Jim Meyering
Subject: Re: [PATCH 1/2] find: add SELinux support
Date: Thu, 06 Aug 2009 12:16:58 +0200

Kamil Dudka wrote:

> On Thu July 30 2009 13:57:00 Jim Meyering wrote:
>> > The attached incremental patch fixes it. Now it works on both Fedora and
>> > Debian. But unfortunately it does not work with the stable version
>> > (4.4.2) of findutils. Could anybody point me to the relevant change in
>> > findutils code? Thanks in advance!
>>
>> With the FTS_CWDFD-adding change you spotted,
>> I suspect that you should be using an FD-based function,
>> like getfileconat or lgetfileconat from coreutils.
>
> It's probably always better to use a FD-based function when working with
> an opened file. However this is not the case I think. Only FD of the traversed
> directory is available when getfilecon() is called. If I want to use FD
> of an opened  file, I need to open the file first. Then I am obviously
> encountering the same problem with relative paths.

With FTS_CWDFD, the working directory does not change.
Instead, fts->fts_cwd_fd is what changes.
You can use getfileconat (fts->fts_cwd_fd, relative_name, &context) to
get the desired context.

> James, what do you think the proper solution is? Is it correct to expect that
> the CWD is changed (or not changed) during the directory tree traverse?
>
> Kamil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]