]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/cli/cli-cmds.c
* cli/cli-cmds.c (shell_escape): Silence warnings from old
[thirdparty/binutils-gdb.git] / gdb / cli / cli-cmds.c
index 312db5cbd0d85e1cc4ee63ddd74150c0c2dd9c5a..45794f7599fc7b68b30a6c4d307cf62675b26d83 100644 (file)
@@ -499,19 +499,20 @@ shell_escape (char *arg, int from_tty)
 #endif
 #else /* Can fork.  */
   int rc, status, pid;
-  char *p, *user_shell;
-
-  if ((user_shell = (char *) getenv ("SHELL")) == NULL)
-    user_shell = "/bin/sh";
-
-  /* Get the name of the shell for arg0 */
-  if ((p = strrchr (user_shell, '/')) == NULL)
-    p = user_shell;
-  else
-    p++;                       /* Get past '/' */
 
   if ((pid = vfork ()) == 0)
     {
+      char *p, *user_shell;
+
+      if ((user_shell = (char *) getenv ("SHELL")) == NULL)
+       user_shell = "/bin/sh";
+
+      /* Get the name of the shell for arg0 */
+      if ((p = strrchr (user_shell, '/')) == NULL)
+       p = user_shell;
+      else
+       p++;                    /* Get past '/' */
+
       if (!arg)
        execl (user_shell, p, 0);
       else