diff options
author | Jim Meyering <meyering@redhat.com> | 2012-06-12 16:13:43 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-06-12 16:32:12 +0200 |
commit | 5c2181c870f4bc1abaee8ffd0b088ab05f87a61c (patch) | |
tree | c46a240defacbef389b0c917541a258230d8e157 /src | |
parent | 07595ed8567368ca7857df974e1d8209716e7ec1 (diff) | |
download | coreutils-5c2181c870f4bc1abaee8ffd0b088ab05f87a61c.tar.xz |
stty: portability: accommodate CIL
* src/stty.c (main): Declare locals "mode" and "new_mode" to be static
to ensure that each is initialized to zero, *including* all padding.
While gcc clears padding of a local automatic initialized to "{ 0, }",
CIL does not, and the C99 standard is not clear on this issue.
Reported by Edward Schwartz. See http://bugs.gnu.org/11675 for details.
Diffstat (limited to 'src')
-rw-r--r-- | src/stty.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stty.c b/src/stty.c index a3fc3dd39..83b502cbc 100644 --- a/src/stty.c +++ b/src/stty.c @@ -730,7 +730,7 @@ main (int argc, char **argv) { /* Initialize to all zeroes so there is no risk memcmp will report a spurious difference in an uninitialized portion of the structure. */ - struct termios mode = { 0, }; + static struct termios mode; enum output_type output_type; int optc; @@ -1003,7 +1003,7 @@ main (int argc, char **argv) { /* Initialize to all zeroes so there is no risk memcmp will report a spurious difference in an uninitialized portion of the structure. */ - struct termios new_mode = { 0, }; + static struct termios new_mode; if (tcsetattr (STDIN_FILENO, TCSADRAIN, &mode)) error (EXIT_FAILURE, errno, "%s", device_name); |