Commit dc00fea3 authored by Pavel Emelyanov's avatar Pavel Emelyanov

net: Dont print error in rule save

This thing is new and can be absent in ip tool, which is OK
and is handled by net.c code itself.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 336b9909
......@@ -172,6 +172,8 @@ extern int is_anon_link_type(char *link, char *type);
extern void *shmalloc(size_t bytes);
extern void shfree_last(void *ptr);
#define CRS_CAN_FAIL 0x1 /* cmd can validly exit with non zero code */
extern int cr_system(int in, int out, int err, char *cmd, char *const argv[], unsigned flags);
extern int cr_system_userns(int in, int out, int err, char *cmd,
char *const argv[], unsigned flags, int userns_pid);
......
......@@ -602,6 +602,7 @@ static int run_ip_tool(char *arg1, char *arg2, char *arg3, int fdin, int fdout,
ret = cr_system(fdin, fdout, -1, ip_tool_cmd,
(char *[]) { "ip", arg1, arg2, arg3, NULL }, flags);
if (ret) {
if (!(flags & CRS_CAN_FAIL))
pr_err("IP tool failed on %s %s\n", arg1, arg2);
return -1;
}
......@@ -663,7 +664,7 @@ static inline int dump_rule(struct cr_imgset *fds)
if (!path)
return -1;
if (run_ip_tool("rule", "save", NULL, -1, img_raw_fd(img), 0)) {
if (run_ip_tool("rule", "save", NULL, -1, img_raw_fd(img), CRS_CAN_FAIL)) {
pr_warn("Check if \"ip rule save\" is supported!\n");
unlinkat(get_service_fd(IMG_FD_OFF), path, 0);
}
......
......@@ -592,7 +592,7 @@ out_chld:
}
if (WIFEXITED(status)) {
if (WEXITSTATUS(status))
if (!(flags & CRS_CAN_FAIL) && WEXITSTATUS(status))
pr_err("exited, status=%d\n", WEXITSTATUS(status));
break;
} else if (WIFSIGNALED(status)) {
......
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