chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
shared: fix wrong assertion in barrier_set_role()
[elogind.git]
/
src
/
shared
/
condition.c
diff --git
a/src/shared/condition.c
b/src/shared/condition.c
index 08bebeee73c22619edd9833dd89b41467cff0972..f34b45f2a9cff97ec2e32bbf80e263ed2381242c 100644
(file)
--- a/
src/shared/condition.c
+++ b/
src/shared/condition.c
@@
-23,23
+23,20
@@
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
-#include <sys/statvfs.h>
#include <fnmatch.h>
#include "sd-id128.h"
#include "util.h"
#include "virt.h"
#include "path-util.h"
#include <fnmatch.h>
#include "sd-id128.h"
#include "util.h"
#include "virt.h"
#include "path-util.h"
-#include "fileio.h"
-#include "unit.h"
#include "architecture.h"
#include "architecture.h"
-#include "virt.h"
#include "smack-util.h"
#include "apparmor-util.h"
#include "ima-util.h"
#include "selinux-util.h"
#include "audit.h"
#include "condition.h"
#include "smack-util.h"
#include "apparmor-util.h"
#include "ima-util.h"
#include "selinux-util.h"
#include "audit.h"
#include "condition.h"
+#include "cap-list.h"
Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
Condition *c;
Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
Condition *c;
@@
-73,11
+70,13
@@
void condition_free(Condition *c) {
free(c);
}
free(c);
}
-
void
condition_free_list(Condition *first) {
+
Condition*
condition_free_list(Condition *first) {
Condition *c, *n;
LIST_FOREACH_SAFE(conditions, c, n, first)
condition_free(c);
Condition *c, *n;
LIST_FOREACH_SAFE(conditions, c, n, first)
condition_free(c);
+
+ return NULL;
}
static int condition_test_kernel_command_line(Condition *c) {
}
static int condition_test_kernel_command_line(Condition *c) {
@@
-93,8
+92,6
@@
static int condition_test_kernel_command_line(Condition *c) {
r = proc_cmdline(&line);
if (r < 0)
return r;
r = proc_cmdline(&line);
if (r < 0)
return r;
- if (r == 0)
- return false;
equal = !!strchr(c->parameter, '=');
p = line;
equal = !!strchr(c->parameter, '=');
p = line;
@@
-103,7
+100,7
@@
static int condition_test_kernel_command_line(Condition *c) {
_cleanup_free_ char *word = NULL;
bool found;
_cleanup_free_ char *word = NULL;
bool found;
- r = unquote_first_word(&p, &word);
+ r = unquote_first_word(&p, &word
, true
);
if (r < 0)
return r;
if (r == 0)
if (r < 0)
return r;
if (r == 0)
@@
-238,7
+235,7
@@
static int condition_test_security(Condition *c) {
static int condition_test_capability(Condition *c) {
_cleanup_fclose_ FILE *f = NULL;
static int condition_test_capability(Condition *c) {
_cleanup_fclose_ FILE *f = NULL;
-
cap_value_
t value;
+
in
t value;
char line[LINE_MAX];
unsigned long long capabilities = -1;
char line[LINE_MAX];
unsigned long long capabilities = -1;
@@
-247,8
+244,8
@@
static int condition_test_capability(Condition *c) {
assert(c->type == CONDITION_CAPABILITY);
/* If it's an invalid capability, we don't have it */
assert(c->type == CONDITION_CAPABILITY);
/* If it's an invalid capability, we don't have it */
-
- if (
cap_from_name(c->parameter, &value)
< 0)
+ value = capability_from_name(c->parameter);
+ if (
value
< 0)
return -EINVAL;
/* If it's a valid capability we default to assume
return -EINVAL;
/* If it's a valid capability we default to assume
@@
-289,7
+286,7
@@
static int condition_test_needs_update(Condition *c) {
if (!path_is_absolute(c->parameter))
return true;
if (!path_is_absolute(c->parameter))
return true;
- p = str
append
a(c->parameter, "/.updated");
+ p = str
join
a(c->parameter, "/.updated");
if (lstat(p, &other) < 0)
return true;
if (lstat(p, &other) < 0)
return true;