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

Resolve TODO: Return uname and gname overrides #2141

Merged
merged 1 commit into from May 13, 2024

Conversation

mmatuska
Copy link
Member

This is a rework of #2061

{
static char errbuff[128];
const char *u, *ue, *g;

*uid = -1;
*gid = -1;

*uname = NULL;
*gname = NULL;

Copy link
Contributor

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.

Copy link
Contributor

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.

cpio/cmdline.c Outdated Show resolved Hide resolved
Copy link
Contributor

@evelikov evelikov left a 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.

@mmatuska mmatuska force-pushed the ataridreams/autoconf branch 2 times, most recently from 5c0db0d to 5844b22 Compare May 10, 2024 11:08
cpio/cpio.c Fixed Show fixed Hide fixed
cpio/cmdline.c Fixed Show fixed Hide fixed
@mmatuska mmatuska force-pushed the ataridreams/autoconf branch 2 times, most recently from 4954f2d to 1bbaef3 Compare May 10, 2024 12:26
Simplify introducing a struct cpio_owner

Co-authored-by: Martin Matuska <martin@matuska.de>
@mmatuska mmatuska merged commit 826c0af into libarchive:master May 13, 2024
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants