-
Notifications
You must be signed in to change notification settings - Fork 246
ls #1272
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
Draft
alejandro-colomar
wants to merge
23
commits into
shadow-maint:master
Choose a base branch
from
alejandro-colomar:ls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
ls #1272
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
…on and rename it Rename it for consistency with the file name itself, and with the FILE* variable that holds the handle to the open file. Also, we don't need to wrap it in conditionals. Just define it unconditionally, and let it be unused if we don't need it. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
And with it, the file that defines it, which does nothing else. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
…shadow/ Signed-off-by: Alejandro Colomar <[email protected]>
This is for consistency with how this is done in sgetsgent(). Now we need to make sure that the list is NULL before the first call, which means that the 'grent' structure must be cleared. Since it's a static object, it's already true, but let's be explicit about it. Since we remember the address of the list in grent.gr_mem (which is static), we don't need to keep 'members' being static too, so we get rid of one static thing. Signed-off-by: Alejandro Colomar <[email protected]>
Imitate how this is done in sgetgrent(). BE CAREFUL: The NULL check needs to be performed after *both* build_list() calls, since we need to make sure that either a NULL or a valid pointer is stored in both .sg_adm and .sg_mem, since we'll call free(3) next time sgetsgent() is called. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Move build_list() to "lib/list.c", where we can reuse it. Signed-off-by: Alejandro Colomar <[email protected]>
In some places we call comma_to_list(), and in others build_list(), and they're essentially the same thing: they transform a comma-separated list into an array of strings. Both of them consider an empty list to have 0 members instead of one. However, they differ in how they treat trailing commas: - comma_to_list() interprets that as an empty field. - build_list() ignores the trailing comma. The behavior of build_list() seems more appropriate, since it allows tools to generate the CSVs more easily. Also, these lists are used to represent user names or group names, so an empty user name makes no sense. This patch makes both functions be more consistent, which will eventually allow us to de-duplicate code. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
get_gid() will fail to parse a number if the field is empty. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
This name tells better what this API does. Signed-off-by: Alejandro Colomar <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've managed to remove one of the
static
, but most of them seem necessary, since these shadow APIs are either libc APIs or similar to libc APIs, and they're specified as using static memory.I've also done a lot of simplification and de-duplication work in surrounding code, especially in code transforming CSVs to lists.
This is queued after #1197