$ systemctl show elogind-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=(null)
↓
$ systemctl show elogind-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=
Partially fixes #6511. Add some basic tests for the printing function.
add = strlen(p);
- if (!GREEDY_REALLOC0(str, allocated, n + add + 2))
+ if (!GREEDY_REALLOC(str, allocated, n + add + 2))
return -ENOMEM;
strcpy(mempcpy(str + n, p, add), " ");
n += add + 1;
}
- if (n != 0)
- str[n - 1] = '\0';
+ if (!GREEDY_REALLOC(str, allocated, n + 1))
+ return -ENOMEM;
+
+ str[n > 0 ? n - 1 : 0] = '\0'; /* truncate the last space, if it's there */
*s = str;
str = NULL;