manager: get rid of compiler warnings

This commit is contained in:
Arnaud Ferraris
2020-12-13 00:55:22 +01:00
parent b495d6c747
commit 9c9169a972

View File

@@ -159,7 +159,7 @@ int main(int argc, char *argv[])
{ {
struct EG25Manager manager; struct EG25Manager manager;
char compatible[32]; char compatible[32];
int fd; int fd, ret;
memset(&manager, 0, sizeof(manager)); memset(&manager, 0, sizeof(manager));
manager.at_fd = -1; manager.at_fd = -1;
@@ -172,8 +172,8 @@ int main(int argc, char *argv[])
g_critical("Unable to read 'compatible' string from device tree"); g_critical("Unable to read 'compatible' string from device tree");
return 1; return 1;
} }
read(fd, compatible, sizeof(compatible)); ret = read(fd, compatible, sizeof(compatible));
if (!strstr(compatible, "pine64,pinephone-1.2")) if (ret > 0 && !strstr(compatible, "pine64,pinephone-1.2"))
manager.braveheart = TRUE; manager.braveheart = TRUE;
close(fd); close(fd);