mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-22 09:39:13 +00:00
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: Kirill Tkhai <ktkhai@virtuozzo.com> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
70cdf43a90
commit
d49fac1ab6
3 changed files with 4 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue