hw/9pfs: Fix error handling in local_mknod

Update local_chown to remove unnecessary if loop

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
Aneesh Kumar K.V 2011-10-25 12:10:39 +05:30
parent 375847a6c0
commit 17b1971f63

View File

@ -281,7 +281,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
if (err == -1) { if (err == -1) {
goto out; goto out;
} }
local_set_xattr(rpath(fs_ctx, path, buffer), credp); err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
if (err == -1) { if (err == -1) {
serrno = errno; serrno = errno;
goto err_end; goto err_end;
@ -551,15 +551,12 @@ static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
char *path = fs_path->data; char *path = fs_path->data;
if ((credp->fc_uid == -1 && credp->fc_gid == -1) || if ((credp->fc_uid == -1 && credp->fc_gid == -1) ||
(fs_ctx->export_flags & V9FS_SM_PASSTHROUGH)) { (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
return lchown(rpath(fs_ctx, path, buffer), credp->fc_uid, (fs_ctx->export_flags & V9FS_SM_NONE)) {
credp->fc_gid); return lchown(rpath(fs_ctx, path, buffer),
credp->fc_uid, credp->fc_gid);
} else if (fs_ctx->export_flags & V9FS_SM_MAPPED) { } else if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
return local_set_xattr(rpath(fs_ctx, path, buffer), credp); return local_set_xattr(rpath(fs_ctx, path, buffer), credp);
} else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
(fs_ctx->export_flags & V9FS_SM_NONE)) {
return lchown(rpath(fs_ctx, path, buffer), credp->fc_uid,
credp->fc_gid);
} }
return -1; return -1;
} }