Skip to contentSkip to conversation

9pfs: don't use AT_EMPTY_PATH in local_set_cred_passthrough()

PATCH In review Greg Kurz 3 participants 3 messages Mar 4, 2017

lore
Share & tools
lore

Greg Kurz

author
#0 lore raw

PATCH 1/1 9pfs: don't use AT_EMPTY_PATH in local_set_cred_passthrough()

The name argument can never be an empty string, and dirfd always point to the containing directory of the file name. AT_EMPTY_PATH is hence useless here. Also it breaks build with glibc version 2.13 and older.

It is actually an oversight of a previous tentative patch to implement this function. We can safely drop it.

---
 hw/9pfs/9p-local.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/9p-local.c +1 -1
index ea9a1ced0394..45e9a1f9b0ca 100644
@@ -349,7 +349,7 @@ static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd,
                                       const char *name, FsCred *credp)
 {
     if (fchownat(dirfd, name, credp->fc_uid, credp->fc_gid,
-                 AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH) < 0) {
+                 AT_SYMLINK_NOFOLLOW) < 0) {
         /*
          * If we fail to change ownership and if we are
          * using security model none. Ignore the error
Tested-by on v1 1/1
#1 lore raw
Quoted 20 lines · Greg Kurz

The name argument can never be an empty string, and dirfd always point to the containing directory of the file name. AT_EMPTY_PATH is hence useless here. Also it breaks build with glibc version 2.13 and older.

It is actually an oversight of a previous tentative patch to implement this function. We can safely drop it.

---
 hw/9pfs/9p-local.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/9p-local.c +0 -0
index ea9a1ced0394..45e9a1f9b0ca 100644

hw/9pfs/9p-local.c static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd, · line 355

Quoted 8 lines
hw/9pfs/9p-local.c +1 -1
@@ -349,7 +349,7 @@ static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd,
                                       const char *name, FsCred *credp)
 {
     if (fchownat(dirfd, name, credp->fc_uid, credp->fc_gid,
-                 AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH) < 0) {
+                 AT_SYMLINK_NOFOLLOW) < 0) {
         /*
          * If we fail to change ownership and if we are
          * using security model none. Ignore the error

Thanks Greg - this, along with the updated version of the previous patch fixes the build for me.

ATB,

Mark.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Greg Kurz
Quoted 4 lines · Greg Kurz

The name argument can never be an empty string, and dirfd always point to the containing directory of the file name. AT_EMPTY_PATH is hence useless here. Also it breaks build with glibc version 2.13 and older.

Quoted 8 lines

It is actually an oversight of a previous tentative patch to implement this function. We can safely drop it.

---
 hw/9pfs/9p-local.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org