fish: Initialize pcmd structure.
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 18 Jan 2011 22:38:05 +0000 (22:38 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 8 Mar 2011 14:52:24 +0000 (14:52 +0000)
On Debian we get this warning which I'm pretty sure is bogus:

fish.c:690: error: 'pcmd.cmd' may be used uninitialized in this
function [-Wuninitialized]
(cherry picked from commit 316ad8311a41869cf5f253225137dd03d1211ce7)

fish/fish.c

index 566d769..59d6120 100644 (file)
@@ -677,7 +677,10 @@ parse_command_line (char *buf, int *exit_on_error_rtn)
   int r;
   const size_t argv_len = sizeof pcmd.argv / sizeof pcmd.argv[0];
 
-  pcmd.pipe = NULL;
+  /* Note that pcmd.pipe must be set to NULL for correct usage.  Other
+   * fields do not need to be, but this silences a gcc warning.
+   */
+  memset (&pcmd, 0, sizeof pcmd);
 
  again:
   /* Skip any initial whitespace before the command. */