fix build warning (#2365)

* fix build warning

* Update selfdrive/common/util.c

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 0bbd080a04bf6373a430811c48345703a9bbc256
This commit is contained in:
Dean Lee
2020-10-20 13:44:24 +08:00
committed by GitHub
parent 2f20a1d5b4
commit 1089f8fa8f

View File

@@ -52,7 +52,7 @@ int write_file(const char* path, const void* data, size_t size) {
}
ssize_t n = write(fd, data, size);
close(fd);
return n == size ? 0 : -1;
return (n >= 0 && (size_t)n == size) ? 0 : -1;
}
void set_thread_name(const char* name) {