[lkml]   [2010]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] Fix a compile error with -fstack-protector, -Wstack-protector and -Werror.
The following is as per Ingo's suggestion. Agains 2.6.36. Thanks.

In the function ui__dialog_yesno(), automatic buffers have to be used as long
as we are compiling perf with the -Wwrite-stings and -Werror options. This is because the
Newt library does not declare the string parameters in newtWinChoice() as
constant when it should.

But the automatic buffers are not large enough to benefit from ssp at least on some gcc versions, e.g. the one that comes with Ubuntu 9.0.4. This along with -Wstack-protector causes a compile warning which is turned into an error by

This patch works around this problem by making the buffers global and static.

Signed-off-by: Brian Gitonga Marete <>
tools/perf/util/ui/util.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 04600e2..c7dc022 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -11,6 +11,9 @@
#include "helpline.h"
#include "util.h"

+static char yes[] = "Yes";
+static char no[] = "No";
newtComponent newt_form__new(void);

static void newt_form__set_exit_keys(newtComponent self)
@@ -109,6 +112,5 @@ out_destroy_form:
bool ui__dialog_yesno(const char *msg)
/* newtWinChoice should really be accepting const char pointers... */
- char yes[] = "Yes", no[] = "No";
return newtWinChoice(NULL, yes, no, (char *)msg) == 1;

 \ /
  Last update: 2010-10-24 23:27    [W:0.082 / U:0.624 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site