mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 17:26:17 +01:00
gio: fix set_selinux_context coding style
Mostly for cosmetic and readability, follow more closely the glib-style. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
f9cc77da73
commit
3f18b77fb3
@ -2699,8 +2699,8 @@ set_mtime_atime (char *filename,
|
|||||||
#ifdef HAVE_SELINUX
|
#ifdef HAVE_SELINUX
|
||||||
static gboolean
|
static gboolean
|
||||||
set_selinux_context (char *filename,
|
set_selinux_context (char *filename,
|
||||||
const GFileAttributeValue *value,
|
const GFileAttributeValue *value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *val;
|
const char *val;
|
||||||
|
|
||||||
@ -2708,28 +2708,29 @@ set_selinux_context (char *filename,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
{
|
{
|
||||||
g_set_error_literal (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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_selinux_enabled ()) {
|
if (!is_selinux_enabled ())
|
||||||
if (setfilecon_raw (filename, val) < 0)
|
{
|
||||||
{
|
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
int errsv = errno;
|
_("SELinux is not enabled on this system"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
g_set_error (error, G_IO_ERROR,
|
if (setfilecon_raw (filename, val) < 0)
|
||||||
g_io_error_from_errno (errsv),
|
{
|
||||||
_("Error setting SELinux context: %s"),
|
int errsv = errno;
|
||||||
g_strerror (errsv));
|
|
||||||
return FALSE;
|
g_set_error (error, G_IO_ERROR,
|
||||||
}
|
g_io_error_from_errno (errsv),
|
||||||
} else {
|
_("Error setting SELinux context: %s"),
|
||||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
g_strerror (errsv));
|
||||||
_("SELinux is not enabled on this system"));
|
return FALSE;
|
||||||
return FALSE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user