diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-11-06 04:47:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-11-10 03:04:32 -0500 |
commit | a3da8e451321c31d88cebd12c234d0aac2a1cc35 (patch) | |
tree | bb9ebc34ecaaf6a18b54a3c874a02403a8a107c9 /tools | |
parent | f6614b7bb405a9b35dd28baea989a749492c46b2 (diff) |
perf, ui: Eliminate stack-smashing protection compiler complaint
The gcc complains about small auto-var strings being allocated from stack space.
Make them const to avoid this:
| CC util/ui/util.o
| cc1: warnings being treated as errors
| util/ui/util.c: In function ‘ui__dialog_yesno’:
| util/ui/util.c:108: error: not protecting function: no buffer at least 8 bytes long
| make: *** [util/ui/util.o] Error 1
The real bug is in the newtWinChoice() ABI - but that's an
externality we cannot fix here, so we use this workaround.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <20101106084724.GA5956@lenovo>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/ui/util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c index 9706d9d40279..056c69521a38 100644 --- a/tools/perf/util/ui/util.c +++ b/tools/perf/util/ui/util.c | |||
@@ -104,9 +104,10 @@ out_destroy_form: | |||
104 | return rc; | 104 | return rc; |
105 | } | 105 | } |
106 | 106 | ||
107 | static const char yes[] = "Yes", no[] = "No"; | ||
108 | |||
107 | bool ui__dialog_yesno(const char *msg) | 109 | bool ui__dialog_yesno(const char *msg) |
108 | { | 110 | { |
109 | /* newtWinChoice should really be accepting const char pointers... */ | 111 | /* newtWinChoice should really be accepting const char pointers... */ |
110 | char yes[] = "Yes", no[] = "No"; | 112 | return newtWinChoice(NULL, (char *)yes, (char *)no, (char *)msg) == 1; |
111 | return newtWinChoice(NULL, yes, no, (char *)msg) == 1; | ||
112 | } | 113 | } |