fuzix ssh bugfix
authorBrett Gordon <beretta42@gmail.com>
Sun, 24 May 2015 15:23:28 +0000 (11:23 -0400)
committerAlan Cox <alan@linux.intel.com>
Sun, 24 May 2015 18:04:56 +0000 (19:04 +0100)
I've improved "ssh" for now until "sh" is working for the 6809
platforms.

This patch for "ssh" fixed two things:
  *  cd to user's home directory on login invocation
  *  a cd without arguments works

Applications/util/ssh.c

index d4d912a..99c1417 100644 (file)
@@ -66,7 +66,7 @@ int main(int argc, char *argval[])
     if (login_sh) {
        home = getenv("HOME");
        if (!home) putenv("HOME=/");
-       chdir("/");
+       chdir(getenv("HOME"));
     }
 
     cprompt = (getuid() == 0) ? "ssh#" : "ssh$";
@@ -90,7 +90,7 @@ int main(int argc, char *argval[])
 
         /* Check for User request to change Current Working Directory */
         else if (strcmp(cmd, "cd") == 0) {
-            stat = chdir(*arg[0] ? arg[0] : getenv("HOME"));
+            stat = chdir(arg[0] ? arg[0] : getenv("HOME"));
             if (stat)
                 perror("cd");
         }