[-V4,22/26] virtio-9p: Use lchown which won't follow symlink

Submitted by jvrao on Aug. 29, 2010, 7:02 p.m.

Details

Message ID 1283108572-20228-23-git-send-email-jvrao@linux.vnet.ibm.com
State New
Headers show

Commit Message

jvrao Aug. 29, 2010, 7:02 p.m.
From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

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

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
---
 hw/virtio-9p-local.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/virtio-9p-local.c b/hw/virtio-9p-local.c
index 6a2108c..eb4797b 100644
--- a/hw/virtio-9p-local.c
+++ b/hw/virtio-9p-local.c
@@ -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