Skip to contentSkip to conversation

virtio-9p: Use lchown which won't follow symlink

PATCH New Aneesh Kumar K.V 1 participant 1 message Jun 30, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-9p: Use lchown which won't follow symlink

We should always use functions which don't follow
symlink on the server

---
 hw/virtio-9p-local.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/virtio-9p-local.c +1 -1
index bc6793a..30e1bda 100644
@@ -101,7 +101,7 @@ static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,
     if (chmod(rpath(fs_ctx, path), credp->fc_mode & 07777) < 0) {
         return -1;
     }
-    if (chown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid) < 0) {
+    if (lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid) < 0) {
         /*
          * If we fail to change ownership and if we are
          * using security model none. Ignore the error
Signature · 1 line
1.7.2.rc0