* [PATCH] Trivial style improvements
@ 2019-05-10 21:56 Jokke Hämäläinen
0 siblings, 0 replies; only message in thread
From: Jokke Hämäläinen @ 2019-05-10 21:56 UTC (permalink / raw)
To: selinux
Yet another trivial style patch while spending the night reading
C code.
---
policycoreutils/setsebool/setsebool.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/policycoreutils/setsebool/setsebool.c b/policycoreutils/setsebool/setsebool.c
index a5157efc..9d8abfac 100644
--- a/policycoreutils/setsebool/setsebool.c
+++ b/policycoreutils/setsebool/setsebool.c
@@ -77,7 +77,7 @@ int main(int argc, char **argv)
/* Add 1 for the '=' */
len = strlen(argv[optind]) + strlen(argv[optind + 1]) + 2;
bool_list[0] = (char *)malloc(len);
- if (bool_list[0] == 0) {
+ if (bool_list[0] == NULL) {
fputs("Out of memory - aborting\n", stderr);
return 1;
}
@@ -133,8 +133,8 @@ static int semanage_set_boolean_list(size_t boolcnt,
goto err;
}
- if (! verbose) {
- semanage_msg_set_callback(handle,NULL, NULL);
+ if (!verbose) {
+ semanage_msg_set_callback(handle, NULL, NULL);
}
managed = semanage_is_managed(handle);
@@ -175,9 +175,9 @@ static int semanage_set_boolean_list(size_t boolcnt,
goto err;
semanage_bool_exists(handle, bool_key, &result);
- if ( !result ) {
+ if (!result) {
semanage_bool_exists_local(handle, bool_key, &result);
- if ( !result ) {
+ if (!result) {
fprintf(stderr, "Boolean %s is not defined\n", boollist[j].name);
goto err;
}
@@ -230,13 +230,13 @@ int setbool(char **list, size_t start, size_t end)
while (i < end) {
name = list[i];
value_ptr = strchr(list[i], '=');
- if (value_ptr == 0) {
+ if (value_ptr == NULL) {
fprintf(stderr,
"setsebool: '=' not found in boolean expression %s\n",
list[i]);
goto err;
}
- *value_ptr = 0;
+ *value_ptr = '\0';
value_ptr++;
if (strcmp(value_ptr, "1") == 0 ||
strcasecmp(value_ptr, "true") == 0 ||
@@ -278,7 +278,7 @@ int setbool(char **list, size_t start, size_t end)
while (i < end) {
name = list[i];
value_ptr = strchr(name, '=');
- *value_ptr = 0;
+ *value_ptr = '\0';
value_ptr++;
if (pwd && pwd->pw_name)
syslog(LOG_NOTICE,
--
2.21.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-10 21:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 21:56 [PATCH] Trivial style improvements Jokke Hämäläinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).