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>
pull/2348/head
Dean Lee 2020-10-20 13:44:24 +08:00 committed by GitHub
parent c85b3de400
commit 0bbd080a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

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) {