pam_systemd: move socket_from_display() from util.[ch] to pam_systemd.c
It's highly specific, kinda legacy (X11…) and only used at one place, let's move this out of the common code, and into pam_systemd.c where it is used.
This commit is contained in:
@@ -77,31 +77,6 @@ bool display_is_local(const char *display) {
|
||||
display[1] <= '9';
|
||||
}
|
||||
|
||||
int socket_from_display(const char *display, char **path) {
|
||||
size_t k;
|
||||
char *f, *c;
|
||||
|
||||
assert(display);
|
||||
assert(path);
|
||||
|
||||
if (!display_is_local(display))
|
||||
return -EINVAL;
|
||||
|
||||
k = strspn(display+1, "0123456789");
|
||||
|
||||
f = new(char, STRLEN("/tmp/.X11-unix/X") + k + 1);
|
||||
if (!f)
|
||||
return -ENOMEM;
|
||||
|
||||
c = stpcpy(f, "/tmp/.X11-unix/X");
|
||||
memcpy(c, display+1, k);
|
||||
c[k] = 0;
|
||||
|
||||
*path = f;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool kexec_loaded(void) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user