Commit c8decae2e135d2331268619aa07701c31595b6c9

Authored by Mark McLoughlin
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
... ... @@ -2036,7 +2036,7 @@ int net_client_init(const char *device, const char *p)
2036 2036 if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
2037 2037 if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) {
2038 2038 fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
2039   - buf, p);
  2039 + chkbuf, p);
2040 2040 return -1;
2041 2041 }
2042 2042 fd = strtol(buf, NULL, 0);
... ... @@ -2049,7 +2049,7 @@ int net_client_init(const char *device, const char *p)
2049 2049 };
2050 2050 if (check_params(chkbuf, sizeof(chkbuf), tap_params, p) < 0) {
2051 2051 fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
2052   - buf, p);
  2052 + chkbuf, p);
2053 2053 return -1;
2054 2054 }
2055 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 2071 int fd;
2072 2072 if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) {
2073 2073 fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
2074   - buf, p);
  2074 + chkbuf, p);
2075 2075 return -1;
2076 2076 }
2077 2077 fd = strtol(buf, NULL, 0);
... ... @@ -2084,7 +2084,7 @@ int net_client_init(const char *device, const char *p)
2084 2084 };
2085 2085 if (check_params(chkbuf, sizeof(chkbuf), listen_params, p) < 0) {
2086 2086 fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
2087   - buf, p);
  2087 + chkbuf, p);
2088 2088 return -1;
2089 2089 }
2090 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 2094 };
2095 2095 if (check_params(chkbuf, sizeof(chkbuf), connect_params, p) < 0) {
2096 2096 fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
2097   - buf, p);
  2097 + chkbuf, p);
2098 2098 return -1;
2099 2099 }
2100 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 2104 };
2105 2105 if (check_params(chkbuf, sizeof(chkbuf), mcast_params, p) < 0) {
2106 2106 fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
2107   - buf, p);
  2107 + chkbuf, p);
2108 2108 return -1;
2109 2109 }
2110 2110 ret = net_socket_mcast_init(vlan, device, name, buf);
... ...