diff options
author | Jan Synacek <jsynacek@redhat.com> | 2013-02-14 16:26:20 +0100 |
---|---|---|
committer | Jan Synacek <jsynacek@redhat.com> | 2013-02-14 16:26:20 +0100 |
commit | 72f6010fc7dd68ea2ecd9431f906d077a7c20181 (patch) | |
tree | 29a7ee0667afd8747147a2d6e684676b11131d89 | |
parent | d73b07787994cf76d85e7363c35f6f8e00cab028 (diff) | |
download | openlmi-providers-72f6010fc7dd68ea2ecd9431f906d077a7c20181.tar.gz openlmi-providers-72f6010fc7dd68ea2ecd9431f906d077a7c20181.tar.xz openlmi-providers-72f6010fc7dd68ea2ecd9431f906d077a7c20181.zip |
LogicalFile: support deleting directories
-rw-r--r-- | src/logicalfile/LMI_UnixDirectoryProvider.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c index d70aae7..47d095a 100644 --- a/src/logicalfile/LMI_UnixDirectoryProvider.c +++ b/src/logicalfile/LMI_UnixDirectoryProvider.c @@ -17,6 +17,8 @@ * * Authors: Jan Synacek <jsynacek@redhat.com> */ +#include <errno.h> +#include <unistd.h> #include <konkret/konkret.h> #include "LMI_UnixDirectory.h" #include "file.h" @@ -81,7 +83,7 @@ static CMPIStatus LMI_UnixDirectoryCreateInstance( if (mkdir(path, 0777) < 0) { char errmsg[BUFLEN]; - snprintf(errmsg, BUFLEN, "Can't mkdir: %s", path); + snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", path, strerror(errno)); CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg); } @@ -105,7 +107,17 @@ static CMPIStatus LMI_UnixDirectoryDeleteInstance( const CMPIResult* cr, const CMPIObjectPath* cop) { - CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); + CMPIStatus st; + CMPIData pathd = CMGetKey(cop, "Name", &st); + const char *path = KChars(pathd.value.string); + + if (rmdir(path) < 0) { + char errmsg[BUFLEN]; + snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", path, strerror(errno)); + CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg); + } + + CMReturn(CMPI_RC_OK); } static CMPIStatus LMI_UnixDirectoryExecQuery( |