<div dir="ltr"><a href="https://android-review.googlesource.com/#/c/152663/">https://android-review.googlesource.com/#/c/152663/</a><br clear="all"><div><br></div><div><span style="color:rgb(0,0,0);font-family:monospace;white-space:pre">libc: Add O_PATH support for fgetxattr / fsetxattr

Support O_PATH file descriptors when handling fgetxattr and fsetxattr.
This avoids requiring file read access to pull extended attributes.

This is needed to support O_PATH file descriptors when calling
SELinux's fgetfilecon() call. In particular, this allows the querying
and setting of SELinux file context by using something like the following
code:

  int dirfd = open("/path/to/dir", O_DIRECTORY);
  int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW);
  char *context;
  fgetfilecon(fd, &context);

This change was motivated by a comment in
</span><a href="https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c" target="_blank" style="color:rgb(6,84,172);text-decoration:none;font-family:monospace;white-space:pre">https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c</a><span style="color:rgb(0,0,0);font-family:monospace;white-space:pre">
</span></div><div><br></div>-- <br><div class="gmail_signature">Elliott Hughes - <a href="http://who/enh" target="_blank">http://who/enh</a> - <a href="http://jessies.org/~enh/" target="_blank">http://jessies.org/~enh/</a><br>Android native code/tools questions? Mail me/drop by/add me as a reviewer.</div>
</div>