Fix warning with gcc-8.
Fixes: https://projects.duckcorp.org/issues/636
This commit is contained in:
parent
0b8269e2d3
commit
d2dcb0adb1
@ -162,7 +162,7 @@ void conf_die(bip_t *bip, char *fmt, ...)
|
|||||||
/* RACE CONDITION! */
|
/* RACE CONDITION! */
|
||||||
int do_pid_stuff(void)
|
int do_pid_stuff(void)
|
||||||
{
|
{
|
||||||
char hname[1024];
|
char hname[512];
|
||||||
char longpath[1024];
|
char longpath[1024];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int fd;
|
int fd;
|
||||||
@ -172,10 +172,12 @@ try_again:
|
|||||||
f = fopen(conf_pid_file, "r");
|
f = fopen(conf_pid_file, "r");
|
||||||
if (f)
|
if (f)
|
||||||
goto pid_is_there;
|
goto pid_is_there;
|
||||||
if (gethostname(hname, 1023) == -1)
|
if (gethostname(hname, 511) == -1)
|
||||||
fatal("%s %s", "gethostname", strerror(errno));
|
fatal("%s %s", "gethostname", strerror(errno));
|
||||||
|
hname[511] = 0;
|
||||||
snprintf(longpath, 1023, "%s.%s.%ld", conf_pid_file, hname,
|
snprintf(longpath, 1023, "%s.%s.%ld", conf_pid_file, hname,
|
||||||
(long unsigned int)getpid());
|
(long unsigned int)getpid());
|
||||||
|
longpath[1023] = 0;
|
||||||
if ((fd = open(longpath, O_CREAT|O_WRONLY, S_IWUSR|S_IRUSR)) == -1)
|
if ((fd = open(longpath, O_CREAT|O_WRONLY, S_IWUSR|S_IRUSR)) == -1)
|
||||||
fatal("Cannot write to PID file (%s) %s", longpath,
|
fatal("Cannot write to PID file (%s) %s", longpath,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user