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 /kernel/dev.c | |
parent | cc8c975f7757ce89d15aad31df6c8b7086169653 (diff) | |
download | libfuse-96249989efe40367841a579c41ec5025c715afb5.tar.gz |
better exit handling
Diffstat (limited to 'kernel/dev.c')
-rw-r--r-- | kernel/dev.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/dev.c b/kernel/dev.c index 1bff1eb..7036153 100644 --- a/kernel/dev.c +++ b/kernel/dev.c @@ -173,7 +173,7 @@ static void request_wait(struct fuse_conn *fc) DECLARE_WAITQUEUE(wait, current); add_wait_queue_exclusive(&fc->waitq, &wait); - while(list_empty(&fc->pending)) { + while(fc->sb != NULL && list_empty(&fc->pending)) { set_current_state(TASK_INTERRUPTIBLE); if(signal_pending(current)) break; @@ -230,17 +230,16 @@ static ssize_t fuse_dev_read(struct file *file, char *buf, size_t nbytes, struct fuse_conn *fc = DEV_FC(file); struct fuse_req *req = NULL; - if(fc->sb == NULL) - return -EPERM; - spin_lock(&fuse_lock); request_wait(fc); - if(!list_empty(&fc->pending)) { + if(fc->sb != NULL && !list_empty(&fc->pending)) { req = list_entry(fc->pending.next, struct fuse_req, list); list_del_init(&req->list); req->locked = 1; } spin_unlock(&fuse_lock); + if(fc->sb == NULL) + return -ENODEV; if(req == NULL) return -ERESTARTSYS; |