ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/ircd.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/ircd.c (file contents):
Revision 6469 by michael, Sun Aug 30 16:46:32 2015 UTC vs.
Revision 6470 by michael, Thu Sep 3 13:06:17 2015 UTC

# Line 146 | Line 146 | make_daemon(void)
146    setsid();
147   }
148  
149 < static int printVersion = 0;
149 > static int printVersion;
150  
151   static struct lgetopt myopts[] =
152   {
153 <  {"configfile", &ConfigGeneral.configfile,
154 <   STRING, "File to use for ircd.conf"},
155 <  {"klinefile",  &ConfigGeneral.klinefile,
156 <   STRING, "File to use for kline database"},
157 <  {"dlinefile",  &ConfigGeneral.dlinefile,
158 <   STRING, "File to use for dline database"},
159 <  {"xlinefile",  &ConfigGeneral.xlinefile,
160 <   STRING, "File to use for xline database"},
161 <  {"resvfile",  &ConfigGeneral.resvfile,
162 <   STRING, "File to use for resv database"},
163 <  {"logfile",    &logFileName,
164 <   STRING, "File to use for ircd.log"},
165 <  {"pidfile",    &pidFileName,
166 <   STRING, "File to use for process ID"},
167 <  {"foreground", &server_state.foreground,
168 <   YESNO, "Run in foreground (don't detach)"},
169 <  {"version",    &printVersion,
170 <   YESNO, "Print version and exit"},
171 <  {"help", NULL, USAGE, "Print this text"},
172 <  {NULL, NULL, STRING, NULL},
153 >  { "configfile", &ConfigGeneral.configfile,
154 >   STRING, "File to use for ircd.conf" },
155 >  { "klinefile",  &ConfigGeneral.klinefile,
156 >   STRING, "File to use for kline database" },
157 >  { "dlinefile",  &ConfigGeneral.dlinefile,
158 >   STRING, "File to use for dline database" },
159 >  { "xlinefile",  &ConfigGeneral.xlinefile,
160 >   STRING, "File to use for xline database" },
161 >  { "resvfile",   &ConfigGeneral.resvfile,
162 >   STRING, "File to use for resv database" },
163 >  { "logfile",    &logFileName,
164 >   STRING, "File to use for ircd.log" },
165 >  { "pidfile",    &pidFileName,
166 >   STRING, "File to use for process ID" },
167 >  { "foreground", &server_state.foreground,
168 >   YESNO, "Run in foreground (don't detach)" },
169 >  { "version",    &printVersion,
170 >   YESNO, "Print version and exit" },
171 >  { "help", NULL, USAGE, "Print this text" },
172 >  { NULL, NULL, STRING, NULL },
173   };
174  
175   void
# Line 286 | Line 286 | write_pidfile(const char *filename)
286  
287    if ((fb = fopen(filename, "w")))
288    {
289 <    char buff[IRCD_BUFSIZE];
289 >    char buf[IRCD_BUFSIZE];
290      unsigned int pid = (unsigned int)getpid();
291  
292 <    snprintf(buff, sizeof(buff), "%u\n", pid);
292 >    snprintf(buf, sizeof(buf), "%u\n", pid);
293  
294 <    if (fputs(buff, fb) == -1)
294 >    if (fputs(buf, fb) == -1)
295        ilog(LOG_TYPE_IRCD, "Error writing to pid file %s: %s",
296             filename, strerror(errno));
297  
# Line 314 | Line 314 | static void
314   check_pidfile(const char *filename)
315   {
316    FILE *fb;
317 <  char buff[IRCD_BUFSIZE];
318 <  pid_t pidfromfile;
317 >  char buf[IRCD_BUFSIZE];
318  
319    if ((fb = fopen(filename, "r")))
320    {
321 <    if (!fgets(buff, 20, fb))
321 >    if (!fgets(buf, 20, fb))
322        ilog(LOG_TYPE_IRCD, "Error reading from pid file %s: %s",
323             filename, strerror(errno));
324      else
325      {
326 <      pidfromfile = atoi(buff);
326 >      pid_t pidfromfile = atoi(buf);
327  
328        if (!kill(pidfromfile, 0))
329        {

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)