diff --git a/criu/filesystems.c b/criu/filesystems.c index d52fe5c3a..e640096d8 100644 --- a/criu/filesystems.c +++ b/criu/filesystems.c @@ -213,7 +213,7 @@ static int write_binfmt_misc_entry(char *mp, char *buf, BinfmtMiscEntry *bme) snprintf(path, PATH_MAX, "%s/%s", mp, bme->name); fd = open(path, O_WRONLY); - if (!fd) { + if (fd < 0) { pr_perror("binfmt_misc: can't open %s", path); goto out; } diff --git a/criu/sk-packet.c b/criu/sk-packet.c index 6e0ad2d43..bcd4ff33e 100644 --- a/criu/sk-packet.c +++ b/criu/sk-packet.c @@ -325,7 +325,7 @@ static int open_socket_map(int pid, struct vma_area *vm) */ fd = dup(le->fe->fd); - if (!fd) { + if (fd < 0) { pr_perror("Can't dup packet sk"); return -1; } diff --git a/test/zdtm/static/binfmt_misc.c b/test/zdtm/static/binfmt_misc.c index 62b9b51e3..26f8b8192 100644 --- a/test/zdtm/static/binfmt_misc.c +++ b/test/zdtm/static/binfmt_misc.c @@ -120,7 +120,7 @@ int main(int argc, char **argv) /* Register binfmt_entries */ sprintf(path, "%s/" "register", dirname); fd = open(path, O_WRONLY); - if (!fd) { + if (fd < 0) { fail("open"); exit(1); } @@ -145,7 +145,7 @@ int main(int argc, char **argv) /* Disable one of the entries */ sprintf(path, "%s/%s", dirname, NAME[0]); fd = open(path, O_WRONLY); - if (!fd || write(fd, "0", 1) != 1) { + if (fd < 0 || write(fd, "0", 1) != 1) { fail("Can't disable %s\n", path); exit(1); }