Commit 42821edc authored by Pavel Emelyanov's avatar Pavel Emelyanov

img: Use errno when checking optional images open fail

There will be no int-fd soon, so one more preparation
to this fact.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 5f2a7ac2
...@@ -2354,7 +2354,7 @@ static int prepare_rlimits_from_fd(int pid) ...@@ -2354,7 +2354,7 @@ static int prepare_rlimits_from_fd(int pid)
*/ */
fd = open_image(CR_FD_RLIMIT, O_RSTR | O_OPT, pid); fd = open_image(CR_FD_RLIMIT, O_RSTR | O_OPT, pid);
if (fd < 0) { if (fd < 0) {
if (fd == -ENOENT) { if (errno == ENOENT) {
pr_info("Skip rlimits for %d\n", pid); pr_info("Skip rlimits for %d\n", pid);
return 0; return 0;
} }
...@@ -2445,7 +2445,7 @@ static int open_signal_image(int type, pid_t pid, unsigned int *nr) ...@@ -2445,7 +2445,7 @@ static int open_signal_image(int type, pid_t pid, unsigned int *nr)
fd = open_image(type, O_RSTR | O_OPT, pid); fd = open_image(type, O_RSTR | O_OPT, pid);
if (fd < 0) { if (fd < 0) {
if (fd == -ENOENT) /* backward compatibility */ if (errno == ENOENT) /* backward compatibility */
return 0; return 0;
else else
return -1; return -1;
......
...@@ -343,7 +343,7 @@ static int restore_file_locks_legacy(int pid) ...@@ -343,7 +343,7 @@ static int restore_file_locks_legacy(int pid)
fd = open_image(CR_FD_FILE_LOCKS_PID, O_RSTR | O_OPT, pid); fd = open_image(CR_FD_FILE_LOCKS_PID, O_RSTR | O_OPT, pid);
if (fd < 0) { if (fd < 0) {
if (fd == -ENOENT) if (errno == ENOENT)
return 0; return 0;
else else
return -1; return -1;
......
...@@ -598,7 +598,7 @@ int prepare_fd_pid(struct pstree_item *item) ...@@ -598,7 +598,7 @@ int prepare_fd_pid(struct pstree_item *item)
if (!fdinfo_per_id) { if (!fdinfo_per_id) {
fdinfo_fd = open_image(CR_FD_FDINFO, O_RSTR | O_OPT, pid); fdinfo_fd = open_image(CR_FD_FDINFO, O_RSTR | O_OPT, pid);
if (fdinfo_fd < 0) { if (fdinfo_fd < 0) {
if (fdinfo_fd == -ENOENT) if (errno == ENOENT)
return 0; return 0;
return -1; return -1;
} }
...@@ -1088,7 +1088,7 @@ int prepare_fs_pid(struct pstree_item *item) ...@@ -1088,7 +1088,7 @@ int prepare_fs_pid(struct pstree_item *item)
ifd = open_image(CR_FD_FS, O_RSTR | O_OPT, pid); ifd = open_image(CR_FD_FS, O_RSTR | O_OPT, pid);
if (ifd < 0) { if (ifd < 0) {
if (ifd == -ENOENT) if (errno == ENOENT)
goto ok; goto ok;
else else
goto out; goto out;
......
...@@ -381,7 +381,7 @@ in: ...@@ -381,7 +381,7 @@ in:
return 1; return 1;
} }
if (*fd == -ENOENT && dir == AT_FDCWD) { if (errno == ENOENT && dir == AT_FDCWD) {
pr_info("Searching irmap cache in parent\n"); pr_info("Searching irmap cache in parent\n");
dir = openat(get_service_fd(IMG_FD_OFF), CR_PARENT_LINK, O_RDONLY); dir = openat(get_service_fd(IMG_FD_OFF), CR_PARENT_LINK, O_RDONLY);
if (dir >= 0) if (dir >= 0)
......
...@@ -389,7 +389,7 @@ int prepare_mm_pid(struct pstree_item *i) ...@@ -389,7 +389,7 @@ int prepare_mm_pid(struct pstree_item *i)
fd = open_image(CR_FD_MM, O_RSTR | O_OPT, pid); fd = open_image(CR_FD_MM, O_RSTR | O_OPT, pid);
if (fd < 0) { if (fd < 0) {
if (fd == -ENOENT) if (errno == ENOENT)
return 0; return 0;
return -1; return -1;
} }
......
...@@ -642,7 +642,7 @@ int collect_image(struct collect_image_info *cinfo) ...@@ -642,7 +642,7 @@ int collect_image(struct collect_image_info *cinfo)
fd = open_image(cinfo->fd_type, O_RSTR | (optional ? O_OPT : 0)); fd = open_image(cinfo->fd_type, O_RSTR | (optional ? O_OPT : 0));
if (fd < 0) { if (fd < 0) {
if (optional && fd == -ENOENT) if (optional && errno == ENOENT)
return 0; return 0;
else else
return -1; return -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