This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Fix some warnings in cli-cmds.c
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 22 Jun 2003 00:24:45 -0400
- Subject: [commit] Fix some warnings in cli-cmds.c
Pointed out by Andrew. I tried to test with the same compiler version, but
I couldn't get it to warn... anyway, this is a microoptimization anyway.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-06-22 Daniel Jacobowitz <drow@mvista.com>
* cli/cli-cmds.c (shell_escape): Silence warnings from old
compilers.
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.32
diff -u -p -r1.32 cli-cmds.c
--- cli/cli-cmds.c 21 Jun 2003 18:38:28 -0000 1.32
+++ cli/cli-cmds.c 22 Jun 2003 00:22:43 -0000
@@ -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