diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2001-11-21 12:21:19 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2001-11-21 12:21:19 +0000 |
commit | 96249989efe40367841a579c41ec5025c715afb5 (patch) | |
tree | 3843dfca5d2795eada5c1123a36369c88fdf801c /lib | |
parent | cc8c975f7757ce89d15aad31df6c8b7086169653 (diff) | |
download | libfuse-96249989efe40367841a579c41ec5025c715afb5.tar.gz |
better exit handling
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 13 | ||||
-rw-r--r-- | lib/fuse_mt.c | 2 |
2 files changed, 9 insertions, 6 deletions
@@ -305,7 +305,7 @@ static int fill_dir(struct fuse_dirhandle *dh, char *name, int type) reclen = FUSE_DIRENT_SIZE(&dirent); res = fwrite(&dirent, reclen, 1, dh->fp); if(res == 0) { - perror("writing directory file"); + perror("fuse: writing directory file"); return -EIO; } return 0; @@ -330,7 +330,7 @@ static void send_reply_raw(struct fuse *f, char *outbuf, size_t outsize) if(res == -1) { /* ENOENT means the operation was interrupted */ if(errno != ENOENT) - perror("writing fuse device"); + perror("fuse: writing device"); } } @@ -342,7 +342,7 @@ static void send_reply(struct fuse *f, struct fuse_in_header *in, int error, struct fuse_out_header *out; if(error > 0) { - fprintf(stderr, "positive error code: %i\n", error); + fprintf(stderr, "fuse: positive error code: %i\n", error); error = -ERANGE; } @@ -861,8 +861,11 @@ struct fuse_cmd *__fuse_read_cmd(struct fuse *f) res = read(f->fd, cmd->buf, FUSE_MAX_IN); if(res == -1) { - perror("reading fuse device"); - /* BAD... This will happen again */ + /* ENODEV means we got unmounted, so we silenty return failure */ + if(errno != ENODEV) { + perror("fuse: reading device"); + /* BAD... This will happen again */ + } free_cmd(cmd); return NULL; } diff --git a/lib/fuse_mt.c b/lib/fuse_mt.c index d33682c..4534d0f 100644 --- a/lib/fuse_mt.c +++ b/lib/fuse_mt.c @@ -34,7 +34,7 @@ static void *do_work(void *data) while(1) { struct fuse_cmd *cmd = __fuse_read_cmd(w->f); if(cmd == NULL) - exit(1); + pthread_exit(NULL); if(f->numavail == 0 && f->numworker < FUSE_MAX_WORKERS) { pthread_mutex_lock(&f->lock); |