Commit c8decae2e135d2331268619aa07701c31595b6c9
1 parent
0aa7a205
net: fix error reporting for some net parameter checks
A small bit of confusion between buffers is causing errors like: qemu: invalid parameter '10' in 'script=/etc/qemu-ifup,fd=10' instead of: qemu: invalid parameter 'script' in 'script=/etc/qemu-ifup,fd=10' Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Showing
1 changed file
with
6 additions
and
6 deletions
net.c
@@ -2036,7 +2036,7 @@ int net_client_init(const char *device, const char *p) | @@ -2036,7 +2036,7 @@ int net_client_init(const char *device, const char *p) | ||
2036 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { | 2036 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { |
2037 | if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) { | 2037 | if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) { |
2038 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", | 2038 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
2039 | - buf, p); | 2039 | + chkbuf, p); |
2040 | return -1; | 2040 | return -1; |
2041 | } | 2041 | } |
2042 | fd = strtol(buf, NULL, 0); | 2042 | fd = strtol(buf, NULL, 0); |
@@ -2049,7 +2049,7 @@ int net_client_init(const char *device, const char *p) | @@ -2049,7 +2049,7 @@ int net_client_init(const char *device, const char *p) | ||
2049 | }; | 2049 | }; |
2050 | if (check_params(chkbuf, sizeof(chkbuf), tap_params, p) < 0) { | 2050 | if (check_params(chkbuf, sizeof(chkbuf), tap_params, p) < 0) { |
2051 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", | 2051 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
2052 | - buf, p); | 2052 | + chkbuf, p); |
2053 | return -1; | 2053 | return -1; |
2054 | } | 2054 | } |
2055 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { | 2055 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { |
@@ -2071,7 +2071,7 @@ int net_client_init(const char *device, const char *p) | @@ -2071,7 +2071,7 @@ int net_client_init(const char *device, const char *p) | ||
2071 | int fd; | 2071 | int fd; |
2072 | if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) { | 2072 | if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) { |
2073 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", | 2073 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
2074 | - buf, p); | 2074 | + chkbuf, p); |
2075 | return -1; | 2075 | return -1; |
2076 | } | 2076 | } |
2077 | fd = strtol(buf, NULL, 0); | 2077 | fd = strtol(buf, NULL, 0); |
@@ -2084,7 +2084,7 @@ int net_client_init(const char *device, const char *p) | @@ -2084,7 +2084,7 @@ int net_client_init(const char *device, const char *p) | ||
2084 | }; | 2084 | }; |
2085 | if (check_params(chkbuf, sizeof(chkbuf), listen_params, p) < 0) { | 2085 | if (check_params(chkbuf, sizeof(chkbuf), listen_params, p) < 0) { |
2086 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", | 2086 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
2087 | - buf, p); | 2087 | + chkbuf, p); |
2088 | return -1; | 2088 | return -1; |
2089 | } | 2089 | } |
2090 | ret = net_socket_listen_init(vlan, device, name, buf); | 2090 | ret = net_socket_listen_init(vlan, device, name, buf); |
@@ -2094,7 +2094,7 @@ int net_client_init(const char *device, const char *p) | @@ -2094,7 +2094,7 @@ int net_client_init(const char *device, const char *p) | ||
2094 | }; | 2094 | }; |
2095 | if (check_params(chkbuf, sizeof(chkbuf), connect_params, p) < 0) { | 2095 | if (check_params(chkbuf, sizeof(chkbuf), connect_params, p) < 0) { |
2096 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", | 2096 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
2097 | - buf, p); | 2097 | + chkbuf, p); |
2098 | return -1; | 2098 | return -1; |
2099 | } | 2099 | } |
2100 | ret = net_socket_connect_init(vlan, device, name, buf); | 2100 | ret = net_socket_connect_init(vlan, device, name, buf); |
@@ -2104,7 +2104,7 @@ int net_client_init(const char *device, const char *p) | @@ -2104,7 +2104,7 @@ int net_client_init(const char *device, const char *p) | ||
2104 | }; | 2104 | }; |
2105 | if (check_params(chkbuf, sizeof(chkbuf), mcast_params, p) < 0) { | 2105 | if (check_params(chkbuf, sizeof(chkbuf), mcast_params, p) < 0) { |
2106 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", | 2106 | fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
2107 | - buf, p); | 2107 | + chkbuf, p); |
2108 | return -1; | 2108 | return -1; |
2109 | } | 2109 | } |
2110 | ret = net_socket_mcast_init(vlan, device, name, buf); | 2110 | ret = net_socket_mcast_init(vlan, device, name, buf); |