diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-07-25 09:49:06 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-07-25 09:49:06 +0100 |
commit | 2406df9ada241a374d1182eef7bd385a77f551ea (patch) | |
tree | 768ab228cafd055142286bd82d0d48927445bb8b | |
parent | 410dbc38e87a3d649746e7f8a0b6be963c5a16e1 (diff) | |
download | xen-2406df9ada241a374d1182eef7bd385a77f551ea.tar.gz xen-2406df9ada241a374d1182eef7bd385a77f551ea.tar.bz2 xen-2406df9ada241a374d1182eef7bd385a77f551ea.zip |
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 <samuel.thibault@eu.citrix.com>
-rw-r--r-- | tools/fs-back/fs-ops.c | 12 |
1 files changed, 11 insertions, 1 deletions
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); |