[apparmor] [PATCH 1/6] libapparmor: Use directory file descriptor in _aa_dirat_for_each()

Seth Arnold seth.arnold at canonical.com
Wed Apr 1 03:52:52 UTC 2015


On Thu, Mar 26, 2015 at 04:47:57PM -0500, Tyler Hicks wrote:
> The _aa_dirat_for_each() function used the DIR * type for its first
> parameter. It then switched back and forth between the directory file
> descriptors, retrieved with dirfd(), and directory streams, retrieved
> with fdopendir(), when making syscalls and calling the call back
> function.
> 
> This patch greatly simplifies the function by simply using directory
> file descriptors. No functionality is lost since callers can still
> easily use the function after calling dirfd() to retrieve the underlying
> file descriptor.
> 
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>

I like the gist of this patch but I think the parameter shouldn't be named
dirfd; if we ever need the dirent.h header back again, this'll cause no
end of confusion. It'd be safer to just pick a less obvious name, dir_fd
for example.

With a name change,
Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150331/d48bf050/attachment.pgp>


More information about the AppArmor mailing list