Commit cda94b27821726df74eead0701d8401c1acda6ec
1 parent
7c3370d4
Revert "Fix output of uninitialized strings"
This reverts commit 8cf07dcb. This is a sorry saga. This commit: 8e4416af net: Add parameter checks for VLAN clients broken '-net socket' and this commit: ffad4116 net: Fix -net socket parameter checks fixed the problem but introduced another problem which this commit: 8cf07dcb Fix output of uninitialized strings fixed that final problem, but causing us to lose some error reporting information in the process. Meanwhile Jan posted a patch to mostly re-do ffad4116 in a way that fixes the original issue, but without losing the error reporting information. So, let's revert 8cf07dcb and apply Jan's patch. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Showing
2 changed files
with
22 additions
and
11 deletions
net.c
| @@ -1912,7 +1912,8 @@ int net_client_init(const char *device, const char *p) | @@ -1912,7 +1912,8 @@ int net_client_init(const char *device, const char *p) | ||
| 1912 | int idx = nic_get_free_idx(); | 1912 | int idx = nic_get_free_idx(); |
| 1913 | 1913 | ||
| 1914 | if (check_params(nic_params, p) < 0) { | 1914 | if (check_params(nic_params, p) < 0) { |
| 1915 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 1915 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 1916 | + buf, p); | ||
| 1916 | return -1; | 1917 | return -1; |
| 1917 | } | 1918 | } |
| 1918 | if (idx == -1 || nb_nics >= MAX_NICS) { | 1919 | if (idx == -1 || nb_nics >= MAX_NICS) { |
| @@ -1962,7 +1963,8 @@ int net_client_init(const char *device, const char *p) | @@ -1962,7 +1963,8 @@ int net_client_init(const char *device, const char *p) | ||
| 1962 | "vlan", "name", "hostname", "restrict", "ip", NULL | 1963 | "vlan", "name", "hostname", "restrict", "ip", NULL |
| 1963 | }; | 1964 | }; |
| 1964 | if (check_params(slirp_params, p) < 0) { | 1965 | if (check_params(slirp_params, p) < 0) { |
| 1965 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 1966 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 1967 | + buf, p); | ||
| 1966 | return -1; | 1968 | return -1; |
| 1967 | } | 1969 | } |
| 1968 | if (get_param_value(buf, sizeof(buf), "hostname", p)) { | 1970 | if (get_param_value(buf, sizeof(buf), "hostname", p)) { |
| @@ -2012,7 +2014,8 @@ int net_client_init(const char *device, const char *p) | @@ -2012,7 +2014,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2012 | char ifname[64]; | 2014 | char ifname[64]; |
| 2013 | 2015 | ||
| 2014 | if (check_params(tap_params, p) < 0) { | 2016 | if (check_params(tap_params, p) < 0) { |
| 2015 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2017 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2018 | + buf, p); | ||
| 2016 | return -1; | 2019 | return -1; |
| 2017 | } | 2020 | } |
| 2018 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { | 2021 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { |
| @@ -2032,7 +2035,8 @@ int net_client_init(const char *device, const char *p) | @@ -2032,7 +2035,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2032 | vlan->nb_host_devs++; | 2035 | vlan->nb_host_devs++; |
| 2033 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { | 2036 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { |
| 2034 | if (check_params(fd_params, p) < 0) { | 2037 | if (check_params(fd_params, p) < 0) { |
| 2035 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2038 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2039 | + buf, p); | ||
| 2036 | return -1; | 2040 | return -1; |
| 2037 | } | 2041 | } |
| 2038 | fd = strtol(buf, NULL, 0); | 2042 | fd = strtol(buf, NULL, 0); |
| @@ -2044,7 +2048,8 @@ int net_client_init(const char *device, const char *p) | @@ -2044,7 +2048,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2044 | "vlan", "name", "ifname", "script", "downscript", NULL | 2048 | "vlan", "name", "ifname", "script", "downscript", NULL |
| 2045 | }; | 2049 | }; |
| 2046 | if (check_params(tap_params, p) < 0) { | 2050 | if (check_params(tap_params, p) < 0) { |
| 2047 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2051 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2052 | + buf, p); | ||
| 2048 | return -1; | 2053 | return -1; |
| 2049 | } | 2054 | } |
| 2050 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { | 2055 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { |
| @@ -2064,7 +2069,8 @@ int net_client_init(const char *device, const char *p) | @@ -2064,7 +2069,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2064 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { | 2069 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { |
| 2065 | int fd; | 2070 | int fd; |
| 2066 | if (check_params(fd_params, p) < 0) { | 2071 | if (check_params(fd_params, p) < 0) { |
| 2067 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2072 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2073 | + buf, p); | ||
| 2068 | return -1; | 2074 | return -1; |
| 2069 | } | 2075 | } |
| 2070 | fd = strtol(buf, NULL, 0); | 2076 | fd = strtol(buf, NULL, 0); |
| @@ -2076,7 +2082,8 @@ int net_client_init(const char *device, const char *p) | @@ -2076,7 +2082,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2076 | "vlan", "name", "listen", NULL | 2082 | "vlan", "name", "listen", NULL |
| 2077 | }; | 2083 | }; |
| 2078 | if (check_params(listen_params, p) < 0) { | 2084 | if (check_params(listen_params, p) < 0) { |
| 2079 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2085 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2086 | + buf, p); | ||
| 2080 | return -1; | 2087 | return -1; |
| 2081 | } | 2088 | } |
| 2082 | ret = net_socket_listen_init(vlan, device, name, buf); | 2089 | ret = net_socket_listen_init(vlan, device, name, buf); |
| @@ -2085,7 +2092,8 @@ int net_client_init(const char *device, const char *p) | @@ -2085,7 +2092,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2085 | "vlan", "name", "connect", NULL | 2092 | "vlan", "name", "connect", NULL |
| 2086 | }; | 2093 | }; |
| 2087 | if (check_params(connect_params, p) < 0) { | 2094 | if (check_params(connect_params, p) < 0) { |
| 2088 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2095 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2096 | + buf, p); | ||
| 2089 | return -1; | 2097 | return -1; |
| 2090 | } | 2098 | } |
| 2091 | ret = net_socket_connect_init(vlan, device, name, buf); | 2099 | ret = net_socket_connect_init(vlan, device, name, buf); |
| @@ -2094,7 +2102,8 @@ int net_client_init(const char *device, const char *p) | @@ -2094,7 +2102,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2094 | "vlan", "name", "mcast", NULL | 2102 | "vlan", "name", "mcast", NULL |
| 2095 | }; | 2103 | }; |
| 2096 | if (check_params(mcast_params, p) < 0) { | 2104 | if (check_params(mcast_params, p) < 0) { |
| 2097 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2105 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2106 | + buf, p); | ||
| 2098 | return -1; | 2107 | return -1; |
| 2099 | } | 2108 | } |
| 2100 | ret = net_socket_mcast_init(vlan, device, name, buf); | 2109 | ret = net_socket_mcast_init(vlan, device, name, buf); |
| @@ -2114,7 +2123,8 @@ int net_client_init(const char *device, const char *p) | @@ -2114,7 +2123,8 @@ int net_client_init(const char *device, const char *p) | ||
| 2114 | int vde_port, vde_mode; | 2123 | int vde_port, vde_mode; |
| 2115 | 2124 | ||
| 2116 | if (check_params(vde_params, p) < 0) { | 2125 | if (check_params(vde_params, p) < 0) { |
| 2117 | - fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); | 2126 | + fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", |
| 2127 | + buf, p); | ||
| 2118 | return -1; | 2128 | return -1; |
| 2119 | } | 2129 | } |
| 2120 | vlan->nb_host_devs++; | 2130 | vlan->nb_host_devs++; |
vl.c
| @@ -2228,7 +2228,8 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) | @@ -2228,7 +2228,8 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) | ||
| 2228 | NULL }; | 2228 | NULL }; |
| 2229 | 2229 | ||
| 2230 | if (check_params(params, str) < 0) { | 2230 | if (check_params(params, str) < 0) { |
| 2231 | - fprintf(stderr, "qemu: unknown parameter in '%s'\n", str); | 2231 | + fprintf(stderr, "qemu: unknown parameter '%s' in '%s'\n", |
| 2232 | + buf, str); | ||
| 2232 | return -1; | 2233 | return -1; |
| 2233 | } | 2234 | } |
| 2234 | 2235 |