/***
This file is part of systemd.
- Copyright 2010 ProFUSION embedded systems
+ Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
c->type = type;
c->negate = negate;
- if (!(c->parameter = strdup(parameter))) {
- free(c);
- return NULL;
- }
+ if (parameter)
+ if (!(c->parameter = strdup(parameter))) {
+ free(c);
+ return NULL;
+ }
return c;
}
case CONDITION_KERNEL_COMMAND_LINE:
return !!test_kernel_command_line(c->parameter) == !c->negate;
+ case CONDITION_NULL:
+ return !c->negate;
+
default:
assert_not_reached("Invalid condition type.");
}
static const char* const condition_type_table[_CONDITION_TYPE_MAX] = {
[CONDITION_KERNEL_COMMAND_LINE] = "ConditionKernelCommandLine",
- [CONDITION_PATH_EXISTS] = "ConditionPathExists"
+ [CONDITION_PATH_EXISTS] = "ConditionPathExists",
+ [CONDITION_NULL] = "ConditionNull"
};
DEFINE_STRING_TABLE_LOOKUP(condition_type, ConditionType);