[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1287955399-25354-1-git-send-email-marete@toshnix.com>
Date: Mon, 25 Oct 2010 00:23:19 +0300
From: Brian Gitonga Marete <marete@...hnix.com>
To: Arnaldo Carvalho de Melo <acme@...radead.org>
Cc: Brian Gitonga Marete <marete@...hnix.com>,
Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
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
-Werror.
This patch works around this problem by making the buffers global and static.
Signed-off-by: Brian Gitonga Marete <marete@...hnix.com>
---
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;
}
--
1.7.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists