mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-01 02:16:38 +02:00
Moved write_pidfile function to ircd.c
This commit is contained in:
@@ -1287,3 +1287,4 @@
|
||||
- Removed warning at SocketLoop
|
||||
- Pointed possible code changes with NEW_IO define for future code changes it
|
||||
will also do some resist do broken codes coming with new io engine.
|
||||
- Moved write_pidfile to ircd.c from s_bsd.c.
|
||||
|
||||
+28
@@ -1678,6 +1678,34 @@ void SocketLoop(void *dummy)
|
||||
}
|
||||
#endif /* ifndef NEW_IO */
|
||||
|
||||
|
||||
/*
|
||||
* write_pidfile is not about bsd sockets its about ircd process
|
||||
* so moved it here.
|
||||
*/
|
||||
void write_pidfile(void)
|
||||
{
|
||||
#ifdef IRCD_PIDFILE
|
||||
int fd;
|
||||
char buff[20];
|
||||
if ((fd = open(IRCD_PIDFILE, O_CREAT | O_WRONLY, 0600)) >= 0)
|
||||
{
|
||||
bzero(buff, sizeof(buff));
|
||||
(void)ircsprintf(buff, "%5d\n", (int)getpid());
|
||||
if (write(fd, buff, strlen(buff)) == -1)
|
||||
Debug((DEBUG_NOTICE, "Error writing to pid file %s",
|
||||
IRCD_PIDFILE));
|
||||
(void)close(fd);
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUGMODE
|
||||
else
|
||||
Debug((DEBUG_NOTICE, "Error opening pid file %s",
|
||||
IRCD_PIDFILE));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* open_debugfile
|
||||
*
|
||||
|
||||
-23
@@ -676,29 +676,6 @@ void init_sys(void)
|
||||
return;
|
||||
}
|
||||
|
||||
void write_pidfile(void)
|
||||
{
|
||||
#ifdef IRCD_PIDFILE
|
||||
int fd;
|
||||
char buff[20];
|
||||
if ((fd = open(IRCD_PIDFILE, O_CREAT | O_WRONLY, 0600)) >= 0)
|
||||
{
|
||||
bzero(buff, sizeof(buff));
|
||||
(void)ircsprintf(buff, "%5d\n", (int)getpid());
|
||||
if (write(fd, buff, strlen(buff)) == -1)
|
||||
Debug((DEBUG_NOTICE, "Error writing to pid file %s",
|
||||
IRCD_PIDFILE));
|
||||
(void)close(fd);
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUGMODE
|
||||
else
|
||||
Debug((DEBUG_NOTICE, "Error opening pid file %s",
|
||||
IRCD_PIDFILE));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the various name strings used to store hostnames. This is set
|
||||
* from either the server's sockhost (if client fd is a tty or localhost)
|
||||
|
||||
Reference in New Issue
Block a user