/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2022 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2024 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
main(int argc, const char *argv[])
{
bool ok, configtest = false;
- bool NGIRCd_NoDaemon = false;
+ bool NGIRCd_NoDaemon = false, NGIRCd_NoSyslog = false;
int i;
size_t n;
#ifdef SNIFFER
NGIRCd_Sniffer = false;
#endif
- strlcpy(NGIRCd_ConfFile, SYSCONFDIR, sizeof(NGIRCd_ConfFile));
- strlcat(NGIRCd_ConfFile, CONFIG_FILE, sizeof(NGIRCd_ConfFile));
Fill_Version();
}
if (strcmp(argv[i], "--nodaemon") == 0) {
NGIRCd_NoDaemon = true;
+ NGIRCd_NoSyslog = true;
ok = true;
}
if (strcmp(argv[i], "--passive") == 0) {
NGIRCd_Sniffer = true;
ok = true;
}
+#endif
+#ifdef SYSLOG
+ if (strcmp(argv[i], "--syslog") == 0) {
+ NGIRCd_NoSyslog = false;
+ ok = true;
+ }
#endif
if (strcmp(argv[i], "--version") == 0) {
Show_Version();
if (argv[i][n] == 'n') {
NGIRCd_NoDaemon = true;
+ NGIRCd_NoSyslog = true;
ok = true;
}
if (argv[i][n] == 'p') {
Show_Version();
exit(1);
}
+#ifdef SYSLOG
+ if (argv[i][n] == 'y') {
+ NGIRCd_NoSyslog = false;
+ ok = true;
+ }
+#endif
if (!ok) {
fprintf(stderr,
NGIRCd_SignalRestart = false;
NGIRCd_SignalQuit = false;
- Log_Init(!NGIRCd_NoDaemon);
+ Log_Init(!NGIRCd_NoSyslog);
Random_Init();
Conf_Init();
Log_ReInit();
Show_Version( void )
{
puts( NGIRCd_Version );
- puts( "Copyright (c)2001-2022 Alexander Barton (<alex@barton.de>) and Contributors." );
+ puts( "Copyright (c)2001-2024 Alexander Barton (<alex@barton.de>) and Contributors." );
puts( "Homepage: <http://ngircd.barton.de/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
#endif
puts( " -t, --configtest read, validate and display configuration; then exit" );
puts( " -V, --version output version information and exit" );
+#ifdef SYSLOG
+ puts( " -y, --syslog log to syslog even when running in the foreground (-n)" );
+#endif
puts( " -h, --help display this help and exit" );
} /* Show_Help */
Log(LOG_ERR, "Can't change group ID to %s(%u): %s!",
grp ? grp->gr_name : "?", Conf_GID,
strerror(real_errno));
- if (real_errno != EPERM)
+ if (real_errno != EPERM && real_errno != EINVAL)
goto out;
}
#ifdef HAVE_SETGROUPS
Log(LOG_ERR, "Can't change user ID to %s(%u): %s!",
pwd ? pwd->pw_name : "?", Conf_UID,
strerror(real_errno));
- if (real_errno != EPERM)
+ if (real_errno != EPERM && real_errno != EINVAL)
goto out;
}
}
initialized = true;
/* Normally a child process is forked which isn't any longer
- * connected to ther controlling terminal. Use "--nodaemon"
+ * connected to the controlling terminal. Use "--nodaemon"
* to disable this "daemon mode" (useful for debugging). */
if (!NGIRCd_NoDaemon) {
pid = fork();
"Can't change working directory to \"%s\": %s!",
pwd->pw_dir, strerror(errno));
} else
- Log(LOG_ERR, "Can't get user informaton for UID %d!?", Conf_UID);
+ Log(LOG_ERR, "Can't get user information for UID %d!?", Conf_UID);
return true;
out: