aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/openrc-pam/openrc-pam.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/openrc-pam/openrc-pam.c b/src/openrc-pam/openrc-pam.c
index eba3846b..60b517b4 100644
--- a/src/openrc-pam/openrc-pam.c
+++ b/src/openrc-pam/openrc-pam.c
@@ -1,13 +1,11 @@
-#include <stdio.h>
+#include <librc.h>
#include <pwd.h>
+#include <security/pam_appl.h>
#include <security/pam_modules.h>
-#include <unistd.h>
-#include <librc.h>
#include <stdbool.h>
+#include <stdio.h>
#include <syslog.h>
-#ifdef __FreeBSD__
-#include <security/pam_appl.h>
-#endif
+#include <unistd.h>
#include "einfo.h"
@@ -15,6 +13,10 @@ static bool exec_openrc(pam_handle_t *pamh, const char *runlevel) {
char *cmd = NULL;
const char *username;
struct passwd *pw = NULL;
+ const char *env = NULL;
+
+ if ((env = pam_getenv(pamh, "XDG_RUNTIME_DIR")) != NULL)
+ setenv("XDG_RUNTIME_DIR", env, 0);
if (pam_get_user(pamh, &username, "username:") != PAM_SUCCESS)
return false;