Commit 34b3c10e authored by yonghong-song's avatar yonghong-song Committed by GitHub

Merge pull request #1475 from palmtenor/log_print

Do not print to stderr if user specified log buffer
parents bf1a54c9 c669257c
...@@ -474,10 +474,12 @@ int bpf_prog_load(enum bpf_prog_type prog_type, const char *name, ...@@ -474,10 +474,12 @@ int bpf_prog_load(enum bpf_prog_type prog_type, const char *name,
} }
} }
// If log_level is not 0, either speficied by user or set due to error, // Check if we should print the log message if log_level is not 0,
// print the log message. // either specified by user or set due to error.
if (attr.log_level > 0) { if (attr.log_level > 0) {
if (log_buf) // Don't print if user enabled logging and provided log buffer,
// but there is no error.
if (log_buf && ret < 0)
bpf_print_hints(ret, log_buf); bpf_print_hints(ret, log_buf);
else if (tmp_log_buf) else if (tmp_log_buf)
bpf_print_hints(ret, tmp_log_buf); bpf_print_hints(ret, tmp_log_buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment