mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
maint: define a macro for IPv4 loopback address
Use a macro instead of hardcoding "127.0.0.1" throughout the sources.
This commit is contained in:
parent
e5ae24bdd2
commit
975ea20f85
@ -79,6 +79,8 @@
|
||||
# define INET_ADDRSTRLEN 16
|
||||
# endif
|
||||
|
||||
# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
|
||||
|
||||
/* String equality tests, suggested by Jim Meyering. */
|
||||
# define STREQ(a, b) (strcmp(a, b) == 0)
|
||||
# define STRCASEEQ(a, b) (c_strcasecmp(a, b) == 0)
|
||||
|
@ -250,10 +250,10 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
||||
SYSCONFDIR "/pki/qemu") < 0)
|
||||
goto error;
|
||||
|
||||
if (VIR_STRDUP(cfg->vncListen, "127.0.0.1") < 0)
|
||||
if (VIR_STRDUP(cfg->vncListen, VIR_LOOPBACK_IPV4_ADDR) < 0)
|
||||
goto error;
|
||||
|
||||
if (VIR_STRDUP(cfg->spiceListen, "127.0.0.1") < 0)
|
||||
if (VIR_STRDUP(cfg->spiceListen, VIR_LOOPBACK_IPV4_ADDR) < 0)
|
||||
goto error;
|
||||
|
||||
/*
|
||||
|
@ -383,11 +383,11 @@ virSocketAddrFormatFull(const virSocketAddr *addr,
|
||||
* nicely for UNIX sockets */
|
||||
if (addr->data.sa.sa_family == AF_UNIX) {
|
||||
if (withService) {
|
||||
if (virAsprintf(&addrstr, "127.0.0.1%s0",
|
||||
if (virAsprintf(&addrstr, VIR_LOOPBACK_IPV4_ADDR"%s0",
|
||||
separator ? separator : ":") < 0)
|
||||
goto error;
|
||||
} else {
|
||||
if (VIR_STRDUP(addrstr, "127.0.0.1") < 0)
|
||||
if (VIR_STRDUP(addrstr, VIR_LOOPBACK_IPV4_ADDR) < 0)
|
||||
goto error;
|
||||
}
|
||||
return addrstr;
|
||||
|
@ -3084,7 +3084,7 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom,
|
||||
|
||||
glisten = virDomainGraphicsGetListen(gr, 0);
|
||||
pret = PrlVmCfg_SetVNCHostName(sdkdom, glisten && glisten->address ?
|
||||
glisten->address : "127.0.0.1");
|
||||
glisten->address : VIR_LOOPBACK_IPV4_ADDR);
|
||||
prlsdkCheckRetGoto(pret, cleanup);
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user