diff options
author | Martin Willi <martin@strongswan.org> | 2007-08-09 07:14:56 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2007-08-09 07:14:56 +0000 |
commit | 10c6cc0a36f5628a4381cf696810b152aff252b7 (patch) | |
tree | f52a2a318963ac806e54bc85af4173063f124bcb /src/dumm/cowfs.c | |
parent | fd4ded974d96273886ea537e5a35ffbe80d4d7b5 (diff) | |
download | strongswan-10c6cc0a36f5628a4381cf696810b152aff252b7.tar.bz2 strongswan-10c6cc0a36f5628a4381cf696810b152aff252b7.tar.xz |
removed Makefile from svn
support for scenario switching
Diffstat (limited to 'src/dumm/cowfs.c')
-rw-r--r-- | src/dumm/cowfs.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/dumm/cowfs.c b/src/dumm/cowfs.c index 941211c6c..2c5dd380b 100644 --- a/src/dumm/cowfs.c +++ b/src/dumm/cowfs.c @@ -795,18 +795,29 @@ static struct fuse_operations cowfs_operations = { /** * Implementation of cowfs_t.set_scenario. */ -static void set_scenario(private_cowfs_t *this, char *path) +static bool set_scenario(private_cowfs_t *this, char *path) { if (this->scen) { free(this->scen); + this->scen = NULL; } if (this->scen_fd > 0) { close(this->scen_fd); + this->scen_fd = -1; } - this->scen = strdup(path); - this->scen_fd = open(path, O_RDONLY | O_DIRECTORY); + if (path) + { + this->scen_fd = open(path, O_RDONLY | O_DIRECTORY); + if (this->scen_fd < 0) + { + DBG1("failed to open scenario overlay directory '%s': %m", path); + return FALSE; + } + this->scen = strdup(path); + } + return TRUE; } /** @@ -839,7 +850,7 @@ cowfs_t *cowfs_create(char *master, char *host, char *mount) struct fuse_args args = {0, NULL, 0}; private_cowfs_t *this = malloc_thing(private_cowfs_t); - this->public.set_scenario = (void(*)(cowfs_t*, char *path))set_scenario; + this->public.set_scenario = (bool(*)(cowfs_t*, char *path))set_scenario; this->public.destroy = (void(*)(cowfs_t*))destroy; this->master_fd = open(master, O_RDONLY | O_DIRECTORY); |