Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 311193
b: refs/heads/master
c: fc3e4d0
h: refs/heads/master
i:
  311191: d1086cd
v: v3
  • Loading branch information
Stephane Eranian authored and Arnaldo Carvalho de Melo committed Jun 11, 2012
1 parent c237f6c commit 2b1e7ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 80c0120a3cca30166c0ab8b24e44be67e97b79af
refs/heads/master: fc3e4d077d5c7a7bc1ad5bc143895b4e070e5a8b
8 changes: 7 additions & 1 deletion trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,12 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
fprintf(stderr, "cannot use both --output and --log-fd\n");
usage_with_options(stat_usage, options);
}

if (output_fd < 0) {
fprintf(stderr, "argument to --log-fd must be a > 0\n");
usage_with_options(stat_usage, options);
}

if (!output) {
struct timespec tm;
mode = append_file ? "a" : "w";
Expand All @@ -1190,7 +1196,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) {
Expand Down

0 comments on commit 2b1e7ec

Please sign in to comment.