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
Resolve TODO: Return uname and gname overrides #2141
Conversation
d090530
to
1d951c4
Compare
{ | ||
static char errbuff[128]; | ||
const char *u, *ue, *g; | ||
|
||
*uid = -1; | ||
*gid = -1; | ||
|
||
*uname = NULL; | ||
*gname = NULL; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caller (rightfully so) does not check any of the arguments when the function fails. So the default initialization above (names and ids) alongside the one in the error path below can be dropped IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid complicating the code (adding else statements as applicable) one can use local variables instead and *outputvar = localvar
at the very end of the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestions are stylistic - the updated PR look good regardless.
5c0db0d
to
5844b22
Compare
4954f2d
to
1bbaef3
Compare
Simplify introducing a struct cpio_owner Co-authored-by: Martin Matuska <martin@matuska.de>
1bbaef3
to
7078929
Compare
This is a rework of #2061