summaryrefslogtreecommitdiff
path: root/lib/privs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/privs.c')
-rw-r--r--lib/privs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/privs.c b/lib/privs.c
index 717a2e48d6..e7df383e5d 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -179,7 +179,7 @@ static pset_t *zcaps2sys(zebra_capabilities_t *zcaps, int num)
for (i = 0; i < num; i++)
count += cap_map[zcaps[i]].num;
- if ((syscaps = XCALLOC(MTYPE_PRIVS, (sizeof(pset_t) * num))) == NULL) {
+ if ((syscaps = XCALLOC(MTYPE_PRIVS, sizeof(pset_t))) == NULL) {
fprintf(stderr, "%s: could not allocate syscaps!", __func__);
return NULL;
}
@@ -210,10 +210,11 @@ int zprivs_change_caps(zebra_privs_ops_t op)
{
cap_flag_value_t cflag;
- /* should be no possibility of being called without valid caps */
- assert(zprivs_state.syscaps_p && zprivs_state.caps);
- if (!(zprivs_state.syscaps_p && zprivs_state.caps))
- exit(1);
+ /* Called without valid caps - just return. Not every daemon needs
+ * privs.
+ */
+ if (zprivs_state.syscaps_p == NULL || zprivs_state.caps == NULL)
+ return 0;
if (op == ZPRIVS_RAISE)
cflag = CAP_SET;