-
Notifications
You must be signed in to change notification settings - Fork 11
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
Don't panic if /var/run/utmp is missing #136
Conversation
Tested it and it doesn't panic anymore as wanted. Reading the glibc code I don't see |
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.
Thanks for the patch!
I tried a testcase in glibc:
cat t.c
#include <utmp.h>
#include <utmpx.h>
#include <errno.h>
#include <stdio.h>
int main() {
errno = 0;
struct utmpx* p = getutxent();
printf("%p; %m\n", p);
return 0;
}
on a system where /var/run/utmp doesn't exist and it set errno to ENOENT
. Probably it does an open
which does this implicitly.
should support the arguments `passwd`, `group`, `initgroups`, `services`, | ||
`ahosts`, `ahostsv4`, and `ahostsv6`. On a regular glibc system the | ||
`getent` binary is provided by it and uses the NSS setup as usual. | ||
Similar, a musl system also provides `getent` (but does not use NSS). |
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 sense is it's not necessary to list all the getent
subcommands here. And this list will grow over time if c-ward adds support for more of the NSS APIs; we can just say it needs getent
as provided on glibc and musl systems.
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.
Good, removed the subcommand list.
In a container as set up by Podman there is no utmp file in (/var)/run. When no file is present, we can return NULL and report the error which applications normally would handle gracefully.
Thanks for the test! I've switched back to my initial version which was to set |
Thanks! |
This is now released in c-gull 0.16.1. |
In a container as set up by Podman there is no utmp file in (/var)/run.
When no file is present, we can return NULL.
getent
.)