style fixes

This commit is contained in:
William Hubbs 2014-07-16 14:48:03 -05:00
parent 010c2ab18b
commit 8b8edc2970

View File

@ -40,8 +40,7 @@
static struct selabel_handle *hnd = NULL; static struct selabel_handle *hnd = NULL;
int int selinux_util_label(const char *path)
selinux_util_label(const char *path)
{ {
int retval = 0; int retval = 0;
int enforce; int enforce;
@ -52,12 +51,12 @@ selinux_util_label(const char *path)
if (retval < 0) if (retval < 0)
return retval; return retval;
if (NULL == hnd) if (!hnd)
return (enforce) ? -1 : 0; return (enforce) ? -1 : 0;
retval = lstat(path, &st); retval = lstat(path, &st);
if (retval < 0) { if (retval < 0) {
if (ENOENT == errno) if (errno == ENOENT)
return 0; return 0;
return (enforce) ? -1 : 0; return (enforce) ? -1 : 0;
} }
@ -65,7 +64,7 @@ selinux_util_label(const char *path)
/* lookup the context */ /* lookup the context */
retval = selabel_lookup_raw(hnd, &con, path, st.st_mode); retval = selabel_lookup_raw(hnd, &con, path, st.st_mode);
if (retval < 0) { if (retval < 0) {
if (ENOENT == errno) if (errno == ENOENT)
return 0; return 0;
return (enforce) ? -1 : 0; return (enforce) ? -1 : 0;
} }
@ -74,9 +73,9 @@ selinux_util_label(const char *path)
retval = lsetfilecon(path, con); retval = lsetfilecon(path, con);
freecon(con); freecon(con);
if (retval < 0) { if (retval < 0) {
if (ENOENT == errno) if (errno == ENOENT)
return 0; return 0;
if (ENOTSUP == errno) if (errno == ENOTSUP)
return 0; return 0;
return (enforce) ? -1 : 0; return (enforce) ? -1 : 0;
} }
@ -88,8 +87,7 @@ selinux_util_label(const char *path)
* Open the label handle * Open the label handle
* returns 1 on success, 0 if no selinux, negative on error * returns 1 on success, 0 if no selinux, negative on error
*/ */
int int selinux_util_open(void)
selinux_util_open(void)
{ {
int retval = 0; int retval = 0;
@ -98,7 +96,7 @@ selinux_util_open(void)
return retval; return retval;
hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0); hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
if (NULL == hnd) if (!hnd)
return -2; return -2;
return 1; return 1;
@ -108,8 +106,7 @@ selinux_util_open(void)
* Close the label handle * Close the label handle
* returns 1 on success, 0 if no selinux, negative on error * returns 1 on success, 0 if no selinux, negative on error
*/ */
int int selinux_util_close(void)
selinux_util_close(void)
{ {
int retval = 0; int retval = 0;