aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termpty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/termpty.c')
-rw-r--r--src/bin/termpty.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 30ee96a..9fb7615 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -575,14 +575,34 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
if (!ty->pid)
{
char buf[256];
+ int ret;
if (cd)
{
- if (chdir(cd) != 0)
+ ret = chdir(cd);
+ if (ret != 0)
{
ERR(_("Could not change current directory to '%s': %s"),
cd, strerror(errno));
- exit(127);
+ cd = getenv("HOME");
+ if (cd)
+ {
+ ret = chdir(cd);
+ if (ret != 0)
+ {
+ ERR(_("Could not change current directory to '%s': %s"),
+ cd, strerror(errno));
+ }
+ }
+ if (ret != 0)
+ {
+ cd = "/";
+ if (chdir(cd) != 0)
+ {
+ ERR(_("Could not change current directory to '%s': %s"),
+ cd, strerror(errno));
+ }
+ }
}
}