05a52831468fdbd68cd99bc114efa73f434b47cb
[openwrt/staging/chunkeey.git] / package / devel / oprofile / patches / 100-musl.patch
1 --- a/pe_profiling/operf.cpp
2 +++ b/pe_profiling/operf.cpp
3 @@ -857,11 +857,14 @@ static int __delete_old_previous_sample_
4 int tflag __attribute__((unused)),
5 struct FTW *ftwbuf __attribute__((unused)))
6 {
7 + int err;
8 +
9 if (remove(fpath)) {
10 + err = errno;
11 perror("sample data removal error");
12 - return FTW_STOP;
13 + return err;
14 } else {
15 - return FTW_CONTINUE;
16 + return 0;
17 }
18 }
19
20 @@ -896,7 +899,7 @@ static void convert_sample_data(void)
21 return;
22
23 if (!operf_options::append) {
24 - int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
25 + int flags = FTW_DEPTH;
26 errno = 0;
27 if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 &&
28 errno != ENOENT) {
29 --- a/libop/op_events.c
30 +++ b/libop/op_events.c
31 @@ -83,7 +83,7 @@ static int parse_hex(char const * str)
32 static u64 parse_long_hex(char const * str)
33 {
34 u64 value;
35 - if (sscanf(str, "%Lx", &value) != 1)
36 + if (sscanf(str, "0x%llx", &value) != 1)
37 parse_error("expected long hexadecimal value");
38
39 fflush(stderr);