util: move display_is_local() to pam_systemd.c, its only user

It's quite specific anyway, hence let's move this where it's used
This commit is contained in:
Lennart Poettering 2019-03-14 12:27:52 +01:00
parent 2b2fec7db0
commit ecd5f1a9e0
3 changed files with 9 additions and 11 deletions

View File

@ -51,15 +51,6 @@ int saved_argc = 0;
char **saved_argv = NULL;
static int saved_in_initrd = -1;
bool display_is_local(const char *display) {
assert(display);
return
display[0] == ':' &&
display[1] >= '0' &&
display[1] <= '9';
}
bool kexec_loaded(void) {
_cleanup_free_ char *s = NULL;

View File

@ -43,8 +43,6 @@ static inline const char* enable_disable(bool b) {
return b ? "enable" : "disable";
}
bool display_is_local(const char *display) _pure_;
#define NULSTR_FOREACH(i, l) \
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)

View File

@ -115,6 +115,15 @@ static int get_user_data(
return PAM_SUCCESS;
}
static bool display_is_local(const char *display) {
assert(display);
return
display[0] == ':' &&
display[1] >= '0' &&
display[1] <= '9';
}
static int socket_from_display(const char *display, char **path) {
size_t k;
char *f, *c;