Commit 054bd4ef authored by Jean-Paul Saman's avatar Jean-Paul Saman

- Cleanup up the use of SYSLOG define and replaced it with HAVE_SYSLOG_H.

- Fixed small bug in daemon code with perror(). It was given a return value instead of a string.
- Fixed configure script to correctly detect --{enable,disable}-syslog or --{enable,disable}-daemon. When
the options were not given the default action was not correctly selected.
parent 51f7ff4e
......@@ -49,7 +49,6 @@ PLUGINS = @PLUGINS@
#
DEBUG=@DEBUG@
PROFILING=@PROFILING@
SYSLOG=@SYSLOG@
#BUILD=BASE_RELEASE
#BUILD=OPTIM_RELASE
......@@ -131,13 +130,6 @@ ifeq ($(PROFILING), 1)
CCFLAGS+=-pg
endif
#
# System Logging
#
ifeq ($(SYSLOG), 1)
CCFLAGS+=-DSYSLOG
endif
#
# Standard release mode
#
......
......@@ -829,7 +829,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-debug Enable debug mode (default disabled)
--enable-profiling Enable profiling mode (default disabled)
--disable-syslog Logging using syslogd (default enable)
--disable-syslog Logging using syslogd (default enabled)
--disable-daemon Disable daemon mode (default enabled)
--disable-dvd DVD support (default enabled)
--enable-dvb DVB support (default disabled)
......@@ -5898,7 +5898,7 @@ if test "${enable_syslog+set}" = set; then
fi
fi;
if test x$enable_syslog = xyes
if test x$enable_syslog != xno
then
if test ${SYSLOG} = 0
then
......@@ -5910,12 +5910,13 @@ using --disable-syslog" >&2;}
fi
fi
DAEMON=1
# Check whether --enable-daemon or --disable-daemon was given.
if test "${enable_daemon+set}" = set; then
enableval="$enable_daemon"
fi;
if test x$enable-daemon = xyes
if test x$enable-daemon != xno
then
if test ${SYSLOG} = 0
then
......@@ -5925,14 +5926,11 @@ echo "$as_me: error: Could not find syslog.h. Syslog is required to run in daemo
using --disable-syslog and --disable-daemon" >&2;}
{ (exit 1); exit 1; }; }
DAEMON=0
NEEDSRC_daemon=0
else
NEEDSRC_daemon=1
DAEMON=1
fi
elif test x$enable-daemon = xno
then
DAEMON=0
NEEDSRC_daemon=0
fi
......
......@@ -263,13 +263,13 @@ dnl SYSLOG
dnl
AC_CHECK_HEADERS(syslog.h, SYSLOG=1, SYSLOG=0)
AC_ARG_ENABLE(syslog,
[ --disable-syslog Logging using syslogd (default enable)],
[ --disable-syslog Logging using syslogd (default enabled)],
[ if test x$enableval = xno
then
SYSLOG=0
fi])
if test x$enable_syslog = xyes
if test x$enable_syslog != xno
then
if test ${SYSLOG} = 0
then
......@@ -281,23 +281,21 @@ fi
dnl
dnl Daemon mode
dnl
DAEMON=1
AC_ARG_ENABLE(daemon,
[ --disable-daemon Disable daemon mode (default enabled)])
if test x$enable-daemon = xyes
if test x$enable-daemon != xno
then
if test ${SYSLOG} = 0
then
AC_MSG_ERROR([Could not find syslog.h. Syslog is required to run in daemon mode. You can alternately configure
using --disable-syslog and --disable-daemon])
DAEMON=0
NEEDSRC_daemon=0
else
NEEDSRC_daemon=1
DAEMON=1
fi
elif test x$enable-daemon = xno
then
DAEMON=0
NEEDSRC_daemon=0
fi
......@@ -514,7 +512,6 @@ AC_SUBST(PLUGINS)
AC_SUBST(DEBUG)
AC_SUBST(PROFILING)
AC_SUBST(SYSLOG)
AC_SUBST(CCFLAGS)
AC_SUBST(DCFLAGS)
......
......@@ -2,7 +2,7 @@
* application.cpp: Application class
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: application.cpp,v 1.19 2003/03/22 16:10:48 titer Exp $
* $Id: application.cpp,v 1.20 2003/04/03 12:27:11 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -71,7 +71,7 @@
#endif
#include <signal.h>
#include <sys/types.h>
#ifdef SYSLOG
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#ifdef HAVE_GETOPT_H
......@@ -254,7 +254,7 @@ handle C_Application::StartLog(const C_String& strClientDescr, u8 iFlags)
// Init the syslog
if (iFlags & LOG_SYSTEM)
{
#ifdef SYSLOG
#ifdef HAVE_SYSLOG_H
openlog("vls", LOG_NOWAIT | LOG_NDELAY | LOG_PID, LOG_USER);
#endif
}
......@@ -273,7 +273,7 @@ void C_Application::StopLog(handle hLog)
// close the syslog
if (m_iLogFlags & LOG_SYSTEM)
{
#ifdef SYSLOG
#ifdef HAVE_SYSLOG_H
closelog();
#endif
}
......
......@@ -2,7 +2,7 @@
* log.cpp: Logging method
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: log.cpp,v 1.7 2002/11/05 02:10:53 nitrox Exp $
* $Id: log.cpp,v 1.8 2003/04/03 12:27:11 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -38,7 +38,7 @@
#include <stdarg.h>
#include <string.h>
#include <time.h>
#ifdef SYSLOG
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#include "common.h"
......@@ -291,7 +291,7 @@ void C_Log::Append(handle hModule, u8 iLevel, const C_String& strMsg)
if (pClient->iFlags & LOG_SYSTEM)
{
#ifdef SYSLOG
#ifdef HAVE_SYSLOG_H
syslog(LOG_INFO,strBuff.GetString());
#endif
}
......
......@@ -2,7 +2,7 @@
* daemon.cpp:
*-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN
* $Id: daemon.cpp,v 1.3 2003/02/20 21:40:46 jpsaman Exp $
* $Id: daemon.cpp,v 1.4 2003/04/03 12:27:11 jpsaman Exp $
*
* Authors: Jean-Paul Saman <saman@natlab.research.philips.com>
*
......@@ -78,7 +78,7 @@ int C_Daemon::DaemonFork()
switch (status)
{
case -1:
perror((const char*)fork());
perror("fork()");
exit(1);
case 0: /* child process */
break;
......@@ -97,7 +97,7 @@ int C_Daemon::DaemonLeaveGroup()
status = setsid();
if (-1 == status)
{
perror((const char*)setsid());
perror("setsid()");
exit(1);
}
#endif
......
# vls configuration file (Example)
# Application wide settings
BEGIN "Vls"
BEGIN "Global"
LogFile = "vls.log" # log file
ScreenLog = "enable" # log to the console
SystemLog = "disable" # log to the systemlog
SystemLog = "enable" # log to the systemlog
END
# Security informations :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment