Commit d49fac1a authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

criu: Fix open() retval analysing

Negative retval is error, while 0 is OK.

v2: More places

travis-ci: success for criu: Fix open() retval analysing
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 70cdf43a
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment