Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite: There's no need to declare aux_groups as an array #2589

Open
vmcj opened this issue Jun 6, 2024 · 1 comment
Open

Rewrite: There's no need to declare aux_groups as an array #2589

vmcj opened this issue Jun 6, 2024 · 1 comment

Comments

@vmcj
Copy link
Member

vmcj commented Jun 6, 2024

          Nitpick: there's no need to declare this as an array if only a single group is set, let alone one of length 10. Maybe for clarity an array is still better though:
		gid_t aux_groups[1];
		aux_groups[0] = rungid;
		if ( setgroups(1, aux_groups) ) error(errno,"cannot clear auxiliary groups");

Also, I guess we can just clear all auxiliary groups, since rungid is already set as the main group, so

		if ( setgroups(0, NULL) ) error(errno,"cannot clear auxiliary groups");

would suffice? (Since this is a C system call, I'm not sure the NULL can be replaced by nullptr.

Originally posted by @eldering in #2344 (comment)

@vmcj
Copy link
Member Author

vmcj commented Jun 6, 2024

It might be this is already fixed in the original PR but we should still discuss if we want to keep or remove the array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant