aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xs.c
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-19 14:25:29 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-19 14:25:29 +0000
commit265d719ce5be2eb71d3a4433b27999350a85e0db (patch)
treebc212221201811e6237d11b6516168f51d5634e8 /tools/xenstore/xs.c
parent9eed83921ee8405fb503348900c6d0e60557223d (diff)
downloadxen-265d719ce5be2eb71d3a4433b27999350a85e0db.tar.gz
xen-265d719ce5be2eb71d3a4433b27999350a85e0db.tar.bz2
xen-265d719ce5be2eb71d3a4433b27999350a85e0db.zip
Make xs_mkdir an xs_rm idempotent.
When modifying libxenstore to transparently restart when the daemon dies, it became apparent that life is simpler when all commands can simply be restarted. So this patch makes a slight semantic change to xs_rm and xs_mkdir: xs_rm now succeeds if the file doesn't exist (as long as the parent exists), and xs_mkdir succeeds if the directory already exists. Noone should notice. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/xenstore/xs.c')
-rw-r--r--tools/xenstore/xs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c
index 9991cefc61..ad17e9d31a 100644
--- a/tools/xenstore/xs.c
+++ b/tools/xenstore/xs.c
@@ -357,7 +357,7 @@ bool xs_write(struct xs_handle *h, const char *path,
}
/* Create a new directory.
- * Returns false on failure.
+ * Returns false on failure, or success if it already exists.
*/
bool xs_mkdir(struct xs_handle *h, const char *path)
{
@@ -365,7 +365,7 @@ bool xs_mkdir(struct xs_handle *h, const char *path)
}
/* Destroy a file or directory (directories must be empty).
- * Returns false on failure.
+ * Returns false on failure, or success if it doesn't exist.
*/
bool xs_rm(struct xs_handle *h, const char *path)
{