mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
Make error codes returned being a negative value
We have a mess in our return codes: some functions return negative values, while others -- positive. Sanitize the return codes and make error condition to return negative values. Reported-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
6
util.c
6
util.c
@@ -51,19 +51,19 @@ int init_logging(const char *name)
|
||||
fd = open(name, O_CREAT | O_WRONLY);
|
||||
if (fd == -1) {
|
||||
pr_perror("Can't create log file %s\n", name);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlimit)) {
|
||||
pr_err("can't get rlimit: %m\n");
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
logfd = rlimit.rlim_cur - 1;
|
||||
if (dup2(fd, logfd) < 0) {
|
||||
pr_err("can't duplicate descriptor 2->%d: %m\n", logfd);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user