summaryrefslogtreecommitdiff
path: root/src/dumm/cowfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dumm/cowfs.c')
-rw-r--r--src/dumm/cowfs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dumm/cowfs.c b/src/dumm/cowfs.c
index 4c16c7c5d..88041811e 100644
--- a/src/dumm/cowfs.c
+++ b/src/dumm/cowfs.c
@@ -709,8 +709,9 @@ static int cowfs_write(const char *path, const char *buf, size_t size,
rel(&path);
- fd = get_rd(path);
- if (fd == this->master_fd)
+ fd = get_wr(path);
+ if (fd == this->master_fd ||
+ (this->over_fd > 0 && fd == this->host_fd))
{
fd = copy(path);
if (fd < 0)
@@ -858,13 +859,15 @@ cowfs_t *cowfs_create(char *master, char *host, char *mount)
{
DBG1("failed to open master filesystem '%s'", master);
free(this);
+ return NULL;
}
this->host_fd = open(host, O_RDONLY | O_DIRECTORY);
- if (this->master_fd < 0)
+ if (this->host_fd < 0)
{
DBG1("failed to open host filesystem '%s'", host);
close(this->master_fd);
free(this);
+ return NULL;
}
this->over_fd = -1;