diff options
author | 2004-09-14 07:13:45 +0000 | |
---|---|---|
committer | 2004-09-14 07:13:45 +0000 | |
commit | 65afea1f884716488005321d54dcdb147dd16d2e (patch) | |
tree | c5c07e448c81ba09658accac8129f576506c0aff /lib | |
parent | 442d96559f69616c5ddb4a859dd29a5bbee8804c (diff) |
fix
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -761,20 +761,27 @@ static void do_getdir(struct fuse *f, struct fuse_in_header *in) dh.fuse = f; dh.fp = tmpfile(); dh.dir = in->ino; - res = -ENOENT; - path = get_path(f, in->ino); - if (path != NULL) { - res = -ENOSYS; - if (f->op.getdir) - res = f->op.getdir(path, &dh, (fuse_dirfil_t) fill_dir); - free(path); - } - fflush(dh.fp); + res = -EIO; + if (dh.fp == NULL) + perror("fuse: failed to create temporary file"); + else { + res = -ENOENT; + path = get_path(f, in->ino); + if (path != NULL) { + res = -ENOSYS; + if (f->op.getdir) + res = f->op.getdir(path, &dh, (fuse_dirfil_t) fill_dir); + free(path); + } + fflush(dh.fp); + } memset(&arg, 0, sizeof(struct fuse_getdir_out)); - arg.fd = fileno(dh.fp); + if (res == 0) + arg.fd = fileno(dh.fp); send_reply(f, in, res, &arg, sizeof(arg)); - fclose(dh.fp); + if (dh.fp != NULL) + fclose(dh.fp); } static void do_mknod(struct fuse *f, struct fuse_in_header *in, |