From: Keir Fraser Date: Fri, 25 Jul 2008 08:49:06 +0000 (+0100) Subject: fs-backend: fix FD allocation for file creation X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14165^2~117 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2406df9ada241a374d1182eef7bd385a77f551ea;p=xen.git fs-backend: fix FD allocation for file creation The creation operation also opens a file, we need to allocate a virtual fd for that too. Signed-off-by: Samuel Thibault --- diff --git a/tools/fs-back/fs-ops.c b/tools/fs-back/fs-ops.c index 6315a4d975..f9f7d4a4ba 100644 --- a/tools/fs-back/fs-ops.c +++ b/tools/fs-back/fs-ops.c @@ -459,7 +459,17 @@ void dispatch_create(struct mount *mount, struct fsif_request *req) else { printf("Issuing create for file: %s\n", full_path); - ret = creat(full_path, mode); + ret = get_fd(mount); + if (ret >= 0) { + int real_fd = creat(full_path, mode); + if (real_fd < 0) + ret = -1; + else + { + mount->fds[ret] = real_fd; + printf("Got FD: %d for real %d\n", ret, real_fd); + } + } } printf("Got ret %d (errno=%d)\n", ret, errno);