Skip to contentSkip to conversation

perf_event: fix 'perf record'

PATCH New Xiao Guangrong 1 participant 1 message Dec 20, 2009 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf_event: fix 'perf record'

'-a' parameter works abnormal in 'perf record', it conduces 'perf sched record' and 'perf kmem record' unwork.

This bug was introduced by:
commit 856e96608a72412d319e498a3a7c557571f811bd

---
 tools/perf/builtin-record.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +2 -2
index 63136d0..105ea23 100644
@@ -483,7 +483,7 @@ static int __cmd_record(int argc __used, const char **argv)
 
 	atexit(atexit_header);
 
-	if (target_pid == -1) {
+	if (target_pid == -1 && argc) {
 		pid = fork();
 		if (pid < 0) {
 			perror("failed to fork");
@@ -667,7 +667,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 
 	argc = parse_options(argc, argv, options, record_usage,
 			    PARSE_OPT_STOP_AT_NON_OPTION);
-	if (!argc && target_pid == -1 && (!system_wide || profile_cpu == -1))
+	if (!argc && target_pid == -1 && !system_wide && profile_cpu == -1)
 		usage_with_options(record_usage, options);
 
 	symbol__init();
Signature · 1 line
1.6.1.2