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 | 1912 | int idx = nic_get_free_idx(); |
| 1913 | 1913 | |
| 1914 | 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 | 1917 | return -1; |
| 1917 | 1918 | } |
| 1918 | 1919 | if (idx == -1 || nb_nics >= MAX_NICS) { |
| ... | ... | @@ -1962,7 +1963,8 @@ int net_client_init(const char *device, const char *p) |
| 1962 | 1963 | "vlan", "name", "hostname", "restrict", "ip", NULL |
| 1963 | 1964 | }; |
| 1964 | 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 | 1968 | return -1; |
| 1967 | 1969 | } |
| 1968 | 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 | 2014 | char ifname[64]; |
| 2013 | 2015 | |
| 2014 | 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 | 2019 | return -1; |
| 2017 | 2020 | } |
| 2018 | 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 | 2035 | vlan->nb_host_devs++; |
| 2033 | 2036 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { |
| 2034 | 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 | 2040 | return -1; |
| 2037 | 2041 | } |
| 2038 | 2042 | fd = strtol(buf, NULL, 0); |
| ... | ... | @@ -2044,7 +2048,8 @@ int net_client_init(const char *device, const char *p) |
| 2044 | 2048 | "vlan", "name", "ifname", "script", "downscript", NULL |
| 2045 | 2049 | }; |
| 2046 | 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 | 2053 | return -1; |
| 2049 | 2054 | } |
| 2050 | 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 | 2069 | if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { |
| 2065 | 2070 | int fd; |
| 2066 | 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 | 2074 | return -1; |
| 2069 | 2075 | } |
| 2070 | 2076 | fd = strtol(buf, NULL, 0); |
| ... | ... | @@ -2076,7 +2082,8 @@ int net_client_init(const char *device, const char *p) |
| 2076 | 2082 | "vlan", "name", "listen", NULL |
| 2077 | 2083 | }; |
| 2078 | 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 | 2087 | return -1; |
| 2081 | 2088 | } |
| 2082 | 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 | 2092 | "vlan", "name", "connect", NULL |
| 2086 | 2093 | }; |
| 2087 | 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 | 2097 | return -1; |
| 2090 | 2098 | } |
| 2091 | 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 | 2102 | "vlan", "name", "mcast", NULL |
| 2095 | 2103 | }; |
| 2096 | 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 | 2107 | return -1; |
| 2099 | 2108 | } |
| 2100 | 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 | 2123 | int vde_port, vde_mode; |
| 2115 | 2124 | |
| 2116 | 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 | 2128 | return -1; |
| 2119 | 2129 | } |
| 2120 | 2130 | vlan->nb_host_devs++; | ... | ... |
vl.c
| ... | ... | @@ -2228,7 +2228,8 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) |
| 2228 | 2228 | NULL }; |
| 2229 | 2229 | |
| 2230 | 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 | 2233 | return -1; |
| 2233 | 2234 | } |
| 2234 | 2235 | ... | ... |