utmp: add suppport for FreeBSD

FreeBSD does not have utempter helper but instead have a ulog-helper
which provides the same set of functionnality, but the call and
arguments are slightly different.
This commit is contained in:
Baptiste Daroussin 2023-04-06 09:04:05 +02:00
parent c13495e26e
commit aa2b29b1bd
4 changed files with 37 additions and 14 deletions

View file

@ -212,19 +212,24 @@ add_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
if (conf->utempter_path == NULL)
return true;
char *const argv[] = {conf->utempter_path, "add", getenv("WAYLAND_DISPLAY"), NULL};
char *const argv[] = {conf->utempter_path, FOOT_UTEMPTER_ADD, getenv("WAYLAND_DISPLAY"), NULL};
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
}
static bool
del_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
{
char *arg1 = NULL;
if (ptmx < 0)
return true;
if (conf->utempter_path == NULL)
return true;
#ifdef FOOT_UTEMPTER_DEL_ARGUMENTS
arg1 = getenv("WAYLAD_DISPLAY");
#endif
char *const argv[] = {conf->utempter_path, "del", getenv("WAYLAND_DISPLAY"), NULL};
char *const argv[] = {conf->utempter_path, FOOT_UTEMPTER_DEL, arg1, NULL};
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
}