[PATCH] Use proper null pointer in execl() calls

Mark Kettenis kettenis@chello.nl
Thu Jan 22 22:21:00 GMT 2004


OpenBSD's stock GCC has some local modifications that make it spit out
warnings when variadic functions like execl() are called without a
proper null pointer as the last arguments.  It caught three instances
in GDB.  The attached patch makes --with-gdb-build-warnings=,-Werror
happy again.

Committed as obvious.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* ser-pipe.c (pipe_open): Use proper null pointer in execl call.
	* cli/cli-cmds.c (shell_escape): Likewise.

 
Index: ser-pipe.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-pipe.c,v
retrieving revision 1.12
diff -u -p -r1.12 ser-pipe.c
--- ser-pipe.c 13 May 2003 19:40:11 -0000 1.12
+++ ser-pipe.c 22 Jan 2004 22:17:07 -0000
@@ -98,7 +98,7 @@ pipe_open (struct serial *scb, const cha
       for (old = pidlist; old; old = old->next)
 	close (fileno (old->fp));	/* don't allow a flush */
 #endif
-      execl ("/bin/sh", "sh", "-c", name, NULL);
+      execl ("/bin/sh", "sh", "-c", name, (char *) 0);
       _exit (127);
     }
 
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.38
diff -u -p -r1.38 cli-cmds.c
--- cli/cli-cmds.c 21 Jan 2004 04:11:16 -0000 1.38
+++ cli/cli-cmds.c 22 Jan 2004 22:17:07 -0000
@@ -504,9 +504,9 @@ shell_escape (char *arg, int from_tty)
 	p++;			/* Get past '/' */
 
       if (!arg)
-	execl (user_shell, p, 0);
+	execl (user_shell, p, (char *) 0);
       else
-	execl (user_shell, p, "-c", arg, 0);
+	execl (user_shell, p, "-c", arg, (char *) 0);
 
       fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
 			  safe_strerror (errno));



More information about the Gdb-patches mailing list