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>
This commit is contained in:
parent
0aa7a205c8
commit
c8decae2e1
12
net.c
12
net.c
@ -2036,7 +2036,7 @@ int net_client_init(const char *device, const char *p)
|
||||
if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
|
||||
if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) {
|
||||
fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
|
||||
buf, p);
|
||||
chkbuf, p);
|
||||
return -1;
|
||||
}
|
||||
fd = strtol(buf, NULL, 0);
|
||||
@ -2049,7 +2049,7 @@ int net_client_init(const char *device, const char *p)
|
||||
};
|
||||
if (check_params(chkbuf, sizeof(chkbuf), tap_params, p) < 0) {
|
||||
fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
|
||||
buf, p);
|
||||
chkbuf, p);
|
||||
return -1;
|
||||
}
|
||||
if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
|
||||
@ -2071,7 +2071,7 @@ int net_client_init(const char *device, const char *p)
|
||||
int fd;
|
||||
if (check_params(chkbuf, sizeof(chkbuf), fd_params, p) < 0) {
|
||||
fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
|
||||
buf, p);
|
||||
chkbuf, p);
|
||||
return -1;
|
||||
}
|
||||
fd = strtol(buf, NULL, 0);
|
||||
@ -2084,7 +2084,7 @@ int net_client_init(const char *device, const char *p)
|
||||
};
|
||||
if (check_params(chkbuf, sizeof(chkbuf), listen_params, p) < 0) {
|
||||
fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
|
||||
buf, p);
|
||||
chkbuf, p);
|
||||
return -1;
|
||||
}
|
||||
ret = net_socket_listen_init(vlan, device, name, buf);
|
||||
@ -2094,7 +2094,7 @@ int net_client_init(const char *device, const char *p)
|
||||
};
|
||||
if (check_params(chkbuf, sizeof(chkbuf), connect_params, p) < 0) {
|
||||
fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
|
||||
buf, p);
|
||||
chkbuf, p);
|
||||
return -1;
|
||||
}
|
||||
ret = net_socket_connect_init(vlan, device, name, buf);
|
||||
@ -2104,7 +2104,7 @@ int net_client_init(const char *device, const char *p)
|
||||
};
|
||||
if (check_params(chkbuf, sizeof(chkbuf), mcast_params, p) < 0) {
|
||||
fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n",
|
||||
buf, p);
|
||||
chkbuf, p);
|
||||
return -1;
|
||||
}
|
||||
ret = net_socket_mcast_init(vlan, device, name, buf);
|
||||
|
Loading…
Reference in New Issue
Block a user