summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarc-André Lureau2019-01-17 12:43:34 +0100
committerSamuel Thibault2019-02-07 14:49:08 +0100
commit3624730a32ff10a4621ba83c459941b5bee5adb1 (patch)
tree2366a0f996bd93b9bae918f5b3b2a1014ee96ca3 /net
parentslirp: generalize guestfwd with a callback based approach (diff)
downloadqemu-3624730a32ff10a4621ba83c459941b5bee5adb1.tar.gz
qemu-3624730a32ff10a4621ba83c459941b5bee5adb1.tar.xz
qemu-3624730a32ff10a4621ba83c459941b5bee5adb1.zip
net/slirp: simplify checking for cmd: prefix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'net')
-rw-r--r--net/slirp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/slirp.c b/net/slirp.c
index ec07f662c0..b91741b8fc 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -773,7 +773,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp)
snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port);
- if ((strlen(p) > 4) && !strncmp(p, "cmd:", 4)) {
+ if (g_str_has_prefix(p, "cmd:")) {
if (slirp_add_exec(s->slirp, &p[4], &server, port) < 0) {
error_setg(errp, "Conflicting/invalid host:port in guest "
"forwarding rule '%s'", config_str);