ip/ipconfig: don't use sprint() when we have variable strings.

This commit is contained in:
cinap_lenrek 2024-10-29 00:17:34 +00:00
parent eb76dc48cd
commit c7fd84937c
2 changed files with 5 additions and 5 deletions

View file

@ -603,9 +603,9 @@ openlisten(void)
if (validip(conf.laddr) &&
(conf.state == Srenewing || conf.state == Srebinding))
sprint(data, "%s/udp!%I!68", conf.mpoint, conf.laddr);
snprint(data, sizeof(data), "%s/udp!%I!68", conf.mpoint, conf.laddr);
else
sprint(data, "%s/udp!*!68", conf.mpoint);
snprint(data, sizeof(data), "%s/udp!*!68", conf.mpoint);
for (n = 0; (cfd = announce(data, devdir)) < 0; n++) {
if(!noconfig)
sysfatal("can't announce for dhcp: %r");
@ -622,7 +622,7 @@ openlisten(void)
fprint(cfd, "ignoreadvice");
sprint(data, "%s/data", devdir);
snprint(data, sizeof(data), "%s/data", devdir);
fd = open(data, ORDWR);
if(fd < 0)
sysfatal("open %s: %r", data);

View file

@ -37,7 +37,7 @@ openlisten(void)
int n, fd, cfd;
char data[128], devdir[40];
sprint(data, "%s/udp!%I!546", conf.mpoint, conf.lladdr);
snprint(data, sizeof(data), "%s/udp!%I!546", conf.mpoint, conf.lladdr);
for (n = 0; (cfd = announce(data, devdir)) < 0; n++) {
if(!noconfig)
sysfatal("can't announce for dhcp: %r");
@ -54,7 +54,7 @@ openlisten(void)
fprint(cfd, "ignoreadvice");
sprint(data, "%s/data", devdir);
snprint(data, sizeof(data), "%s/data", devdir);
fd = open(data, ORDWR);
if(fd < 0)
sysfatal("open %s: %r", data);