* [PATCH] perf stat: fix output selection introduced in 56f3bae7
@ 2012-04-19 8:13 Łukasz Stelmach
2012-04-19 8:16 ` Łukasz Stelmach
0 siblings, 1 reply; 2+ messages in thread
From: Łukasz Stelmach @ 2012-04-19 8:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Łukasz Stelmach, Kyungmin Park
56f3bae7 makes perf require either --output or --log-fd. Without them
perf exited after erroneously trying to open stdout (file descriptor 0
by default) for writing.
Signed-off-by: Łuaksz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
tools/perf/builtin-stat.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c941bb6..c0f8129 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -196,7 +196,7 @@ static bool csv_output = false;
static bool group = false;
static const char *output_name = NULL;
static FILE *output = NULL;
-static int output_fd;
+static int output_fd = -1;
static volatile int done = 0;
@@ -1146,7 +1146,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
if (output_name && strcmp(output_name, "-"))
output = NULL;
- if (output_name && output_fd) {
+ if (output_name && output_fd >= 0) {
fprintf(stderr, "cannot use both --output and --log-fd\n");
usage_with_options(stat_usage, options);
}
@@ -1161,7 +1161,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
}
clock_gettime(CLOCK_REALTIME, &tm);
fprintf(output, "# started on %s\n", ctime(&tm.tv_sec));
- } else if (output_fd != 2) {
+ } else if (output_fd >= 0) {
mode = append_file ? "a" : "w";
output = fdopen(output_fd, mode);
if (!output) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] perf stat: fix output selection introduced in 56f3bae7
2012-04-19 8:13 [PATCH] perf stat: fix output selection introduced in 56f3bae7 Łukasz Stelmach
@ 2012-04-19 8:16 ` Łukasz Stelmach
0 siblings, 0 replies; 2+ messages in thread
From: Łukasz Stelmach @ 2012-04-19 8:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Kyungmin Park
Łukasz Stelmach <l.stelmach@samsung.com> writes:
> 56f3bae7 makes perf require either --output or --log-fd. Without them
> perf exited after erroneously trying to open stdout (file descriptor 0
> by default) for writing.
It should be "stdin" not "stdout".
--
Łukasz Stelmach
Software engineer
Samsung Poland R&D Center
ul. Polna 11, 00-633 Warszawa
http://www.rd.samsung.pl
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-19 8:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 8:13 [PATCH] perf stat: fix output selection introduced in 56f3bae7 Łukasz Stelmach
2012-04-19 8:16 ` Łukasz Stelmach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).