Message ID | 20190117114359.5164-3-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
Series | slirp: make it again a standalone project (part 2) | expand |
Marc-André Lureau, le jeu. 17 janv. 2019 15:43:34 +0400, a ecrit:
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
It's not strictly the same (g_str_has_prefix doesn't test that there are
characters after the prefix), but that should be fine, applied, thanks!
diff --git a/net/slirp.c b/net/slirp.c index ec07f662c00..b91741b8fc1 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);
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- net/slirp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)