Skip to content

Commit

Permalink
clang: Fix file_exists_and_ownedby return value (#4935)
Browse files Browse the repository at this point in the history
commit 008ea09 (clang: check header ownership) updates file_exists()
to file_exists_and_ownedby(), add verifies onwer, but the return value
is different from before, causing problems with the original code.

Signed-off-by: Chunsheng Luo <luochunsheng@ustc.edu>
  • Loading branch information
luochenglcs authored Mar 17, 2024
1 parent 15a2dec commit c00d69c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cc/frontends/clang/kbuild_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
static inline int file_exists_and_ownedby(const char *f, uid_t uid)
{
struct stat buffer;
int ret;
if ((ret = stat(f, &buffer)) == 0) {
int ret = stat(f, &buffer) == 0;
if (ret) {
if (buffer.st_uid != uid) {
std::cout << "ERROR: header file ownership unexpected: " << std::string(f) << "\n";
return -1;
Expand Down

0 comments on commit c00d69c

Please sign in to comment.