From Linux manual page of capng_change_id():
Note: the only safe action to do upon failure of this function is to
probably exit. This is because you are likely in a situation with par-
tial permissions and not what you intended.
(backported from commit
e6a56690 in master)
#ifdef HAVE_LIBCAP_NG
{
int ret = capng_change_id(pw->pw_uid, pw->pw_gid, CAPNG_NO_FLAG);
#ifdef HAVE_LIBCAP_NG
{
int ret = capng_change_id(pw->pw_uid, pw->pw_gid, CAPNG_NO_FLAG);
- if (ret < 0) {
- fprintf(stderr, "error : ret %d\n", ret);
- } else {
+ if (ret < 0)
+ error("capng_change_id(): return %d\n", ret);
+ else
fprintf(stderr, "dropped privs to %s\n", username);
fprintf(stderr, "dropped privs to %s\n", username);
}
#else
if (initgroups(pw->pw_name, pw->pw_gid) != 0 ||
}
#else
if (initgroups(pw->pw_name, pw->pw_gid) != 0 ||