summaryrefslogtreecommitdiffstats
path: root/src/logicalfile/LMI_UnixFileProvider.c
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2013-09-18 08:33:03 +0200
committerJan Synacek <jsynacek@redhat.com>2013-09-18 15:19:30 +0200
commitcd13c983a49ce3685a3813e66001bd3ea8f796c8 (patch)
treec79386678dbfdbfbdbbccb48d690f7cd3f475c50 /src/logicalfile/LMI_UnixFileProvider.c
parent2746832524f5e5d022b13ffa0890f895ab82355c (diff)
downloadopenlmi-providers-cd13c983a49ce3685a3813e66001bd3ea8f796c8.tar.gz
openlmi-providers-cd13c983a49ce3685a3813e66001bd3ea8f796c8.tar.xz
openlmi-providers-cd13c983a49ce3685a3813e66001bd3ea8f796c8.zip
logicalfile: code cleanup and rewrite
GetInstance() calls were rewritten using cleaner code. Also, the macros that were used before were either rewritten to functions, or cleaned up so they wouldn't return or do anything unexpected. Helper functions now use CMPIStatus more consistently. Some memory leaks were fixed.
Diffstat (limited to 'src/logicalfile/LMI_UnixFileProvider.c')
-rw-r--r--src/logicalfile/LMI_UnixFileProvider.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/logicalfile/LMI_UnixFileProvider.c b/src/logicalfile/LMI_UnixFileProvider.c
index 6b3a45e..9c9be79 100644
--- a/src/logicalfile/LMI_UnixFileProvider.c
+++ b/src/logicalfile/LMI_UnixFileProvider.c
@@ -32,6 +32,8 @@ static const CMPIBroker* _cb = NULL;
static pthread_mutex_t selinux_mutex;
static struct selabel_handle *_selabel_hnd = NULL;
+/* XXX: selabel_close() and freecon() do no work as expected
+ * see bug #1008924 */
static struct selabel_handle *get_selabel_handle()
{
static struct timeval timestamp = {.tv_sec = 0, .tv_usec = 0};
@@ -117,6 +119,7 @@ static CMPIStatus LMI_UnixFileGetInstance(
struct stat sb;
char aux[BUFLEN];
const char *path;
+ char *fsname;
st = lmi_check_required(_cb, cop);
if (st.rc != CMPI_RC_OK) {
@@ -132,8 +135,8 @@ static CMPIStatus LMI_UnixFileGetInstance(
}
/* set ignored stuff */
LMI_UnixFile_Set_FSCreationClassName(&lmi_file, FSCREATIONCLASSNAME);
- char *fsname;
- get_fsname_from_stat(&sb, &fsname);
+ st = get_fsname_from_stat(_cb, &sb, &fsname);
+ check_status(st);
LMI_UnixFile_Set_FSName(&lmi_file, fsname);
free(fsname);
get_class_from_stat(&sb, aux);