aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/config.c b/config.c
index 246e0d18..4303c4ab 100644
--- a/config.c
+++ b/config.c
@@ -44,15 +44,19 @@ static const uint32_t default_bright[] = {
static char *
get_shell(void)
{
- struct passwd *passwd = getpwuid(getuid());
- if (passwd == NULL) {
- LOG_ERRNO("failed to lookup user");
- return NULL;
+ const char *shell = getenv("SHELL");
+
+ if (shell == NULL) {
+ struct passwd *passwd = getpwuid(getuid());
+ if (passwd == NULL) {
+ LOG_ERRNO("failed to lookup user");
+ return NULL;
+ }
+
+ shell = passwd->pw_shell;
}
- const char *shell = passwd->pw_shell;
LOG_DBG("user's shell: %s", shell);
-
return strdup(shell);
}