Bug 556334 – Warning when building without selinux support

2008-10-14  Matthias Clasen  <mclasen@redhat.com>

        Bug 556334 – Warning when building without selinux support

        * glocalfileinfo.c: Avoid compiler warnings when selinux is
        disabled. Patch by Pascal Terjan


svn path=/branches/glib-2-18/; revision=7602
This commit is contained in:
Matthias Clasen
2008-10-15 03:40:53 +00:00
committed by Matthias Clasen
parent e999f10a8f
commit 6ec48813f1
2 changed files with 23 additions and 11 deletions

View File

@@ -1,3 +1,12 @@
2008-10-14 Matthias Clasen <mclasen@redhat.com>
Merged from trunk:
Bug 556334 Warning when building without selinux support
* glocalfileinfo.c: Avoid compiler warnings when selinux is
disabled. Patch by Pascal Terjan
2008-10-13 Alexander Larsson <alexl@redhat.com> 2008-10-13 Alexander Larsson <alexl@redhat.com>
Merged from trunk: Merged from trunk:

View File

@@ -184,6 +184,7 @@ read_link (const gchar *full_name)
#endif /* S_ISLNK */ #endif /* S_ISLNK */
#ifdef HAVE_SELINUX
/* Get the SELinux security context */ /* Get the SELinux security context */
static void static void
get_selinux_context (const char *path, get_selinux_context (const char *path,
@@ -191,7 +192,6 @@ get_selinux_context (const char *path,
GFileAttributeMatcher *attribute_matcher, GFileAttributeMatcher *attribute_matcher,
gboolean follow_symlinks) gboolean follow_symlinks)
{ {
#ifdef HAVE_SELINUX
char *context; char *context;
if (!g_file_attribute_matcher_matches (attribute_matcher, G_FILE_ATTRIBUTE_SELINUX_CONTEXT)) if (!g_file_attribute_matcher_matches (attribute_matcher, G_FILE_ATTRIBUTE_SELINUX_CONTEXT))
@@ -216,8 +216,8 @@ get_selinux_context (const char *path,
freecon (context); freecon (context);
} }
} }
#endif
} }
#endif
#ifdef HAVE_XATTR #ifdef HAVE_XATTR
@@ -1659,7 +1659,9 @@ _g_local_file_info_get (const char *basename,
get_access_rights (attribute_matcher, info, path, &statbuf, parent_info); get_access_rights (attribute_matcher, info, path, &statbuf, parent_info);
#ifdef HAVE_SELINUX
get_selinux_context (path, info, attribute_matcher, (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) == 0); get_selinux_context (path, info, attribute_matcher, (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) == 0);
#endif
get_xattrs (path, TRUE, info, attribute_matcher, (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) == 0); get_xattrs (path, TRUE, info, attribute_matcher, (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) == 0);
get_xattrs (path, FALSE, info, attribute_matcher, (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) == 0); get_xattrs (path, FALSE, info, attribute_matcher, (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) == 0);
@@ -1785,6 +1787,7 @@ get_byte_string (const GFileAttributeValue *value,
} }
#endif #endif
#ifdef HAVE_SELINUX
static gboolean static gboolean
get_string (const GFileAttributeValue *value, get_string (const GFileAttributeValue *value,
const char **val_out, const char **val_out,
@@ -1792,7 +1795,7 @@ get_string (const GFileAttributeValue *value,
{ {
if (value->type != G_FILE_ATTRIBUTE_TYPE_STRING) if (value->type != G_FILE_ATTRIBUTE_TYPE_STRING)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Invalid attribute type (byte string expected)")); _("Invalid attribute type (byte string expected)"));
return FALSE; return FALSE;
} }
@@ -1801,7 +1804,7 @@ get_string (const GFileAttributeValue *value,
return TRUE; return TRUE;
} }
#endif
static gboolean static gboolean
set_unix_mode (char *filename, set_unix_mode (char *filename,
@@ -2047,6 +2050,7 @@ set_mtime_atime (char *filename,
#endif #endif
#ifdef HAVE_SELINUX
static gboolean static gboolean
set_selinux_context (char *filename, set_selinux_context (char *filename,
const GFileAttributeValue *value, const GFileAttributeValue *value,
@@ -2059,12 +2063,11 @@ set_selinux_context (char *filename,
if (val == NULL) if (val == NULL)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("SELinux context must be non-NULL")); _("SELinux context must be non-NULL"));
return FALSE; return FALSE;
} }
#ifdef HAVE_SELINUX
if (is_selinux_enabled ()) { if (is_selinux_enabled ()) {
security_context_t val_s; security_context_t val_s;
@@ -2082,14 +2085,14 @@ set_selinux_context (char *filename,
} }
g_free (val_s); g_free (val_s);
} else { } else {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("SELinux is not enabled on this system")); _("SELinux is not enabled on this system"));
return FALSE; return FALSE;
} }
#endif
return TRUE; return TRUE;
} }
#endif
gboolean gboolean