fix clang warnings that are bugs#3917
Conversation
the suffix is always removed, not only when present due to an assignment that should be a comparission See-also: ptitSeb#3916 Signed-off-by: Pepper Gray <hello@peppergray.xyz>
- the pid should only be returned, when the path matches w, but is always returned. - pass p as is (is already a pointer) See-Also: ptitSeb#3916 Signed-off-by: Pepper Gray <hello@peppergray.xyz>
pid is missing in path construction See-Also: ptitSeb#3916 Signed-off-by: Pepper Gray <hello@peppergray.xyz>
| if(sscanf(path, "/proc/%d/%s", &pid, &p)==2) | ||
| if(p && !strcmp(p, w)) | ||
| if(sscanf(path, "/proc/%d/%s", &pid, p)==2) | ||
| if(strcmp(p, w) == 0) |
There was a problem hiding this comment.
The change from !strcmp(...) tp strcmp(...) == 0 smells a lot like A.I. A human would have just removed the leading p && ...
(the comments of the PR/Tickets are also very verbose)
Just a reminder, we ask everyone to declare if they use A.I for a PR, and not to let A.I. do all the comunication (creating tickets), as we are human handling the tickets.
Also also, it's always nice to see wich agent are use to do stuffs.
There was a problem hiding this comment.
The form strcmp(...) == 0 is used on the lines just below (L2059-64), so I thought I'll keep the style consistent:
if(strcmp((const char*)path, tmp)==0)
return 1;
// check if self PID ....
pid_t pid = getpid();
sprintf(tmp, "/proc/%d/%s", pid, w);
if(strcmp((const char*)path, tmp)==0)I used to get feedback on my PRs that I'm too minimalistic, so I started being more verbose. Also I'm on arm64 Gentoo/musl/libcxx which is usually not supported by projects, so I try to make it easy for maintainers in the hopes to get them more likely upstreamed.
Sorry for not acting human enough 😅
There was a problem hiding this comment.
Ah well, sorry, I ted to be more and more paranoiac...
Oh, musl, interesting...
There was a problem hiding this comment.
No worries. Crazy times...
I'm not familiar with the source base, so I'm curious if I can get musl to work or hit a roadblock. But so far it looks good and Android doesn't use glibc either, so it shouldn't be I'm cautiously optimistic 🤞
There was a problem hiding this comment.
Well, there is no specific musl support, but having a build that does run musl x64 binry should be possible without too much trouble... Running glibc x64 binary is another story tho....
I split this PR from the previous, because these are not just fixes to warnings, but to behaviour, because the warning is caused by bugs (see also #3916)
the suffix is always removed, not only when present due to an assignment
that should be a comparison
the pid should only be returned, when the path matches w, but is always
returned. Pass p as is (is already a pointer)
pid is missing in path construction