* Add a separate option log_dir for the log directory.

This commit is contained in:
Justin Maggard 2010-10-27 00:51:39 +00:00
parent b66f85936f
commit bd22632840
6 changed files with 25 additions and 2 deletions

View File

@ -12,6 +12,8 @@ CONFIGMACRO="__CONFIG_H__"
# Database path
DB_PATH="/tmp/minidlna"
# Log path
LOG_PATH="${DB_PATH}"
# detecting the OS name and version
OS_NAME=`uname -s`
@ -116,6 +118,7 @@ case $OS_NAME in
OS_NAME=Debian
OS_VERSION=`cat /etc/debian_version`
OS_URL=http://www.debian.org/
LOG_PATH="/var/log"
# use lsb_release (Linux Standard Base) when available
LSB_RELEASE=`which lsb_release 2>/dev/null`
if [ 0 -eq $? ]; then
@ -146,6 +149,10 @@ echo "/* full path of the file database */" >> ${CONFIGFILE}
echo "#define DEFAULT_DB_PATH \"${DB_PATH}\"" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE}
echo "/* full path of the log directory */" >> ${CONFIGFILE}
echo "#define DEFAULT_LOG_PATH \"${LOG_PATH}\"" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE}
echo "/* Comment the following line to use home made daemonize() func instead" >> ${CONFIGFILE}
echo " * of BSD daemon() */" >> ${CONFIGFILE}
echo "#define USE_DAEMON" >> ${CONFIGFILE}

View File

@ -410,6 +410,18 @@ init(int argc, char * * argv)
}
strncpy(db_path, path, PATH_MAX);
break;
case UPNPLOGDIR:
path = realpath(ary_options[i].value, real_path);
if( !path )
path = (ary_options[i].value);
make_dir(path, S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO);
if( access(path, F_OK) != 0 )
{
DPRINTF(E_FATAL, L_GENERAL, "Log path not accessible! [%s]\n", path);
break;
}
strncpy(log_path, path, PATH_MAX);
break;
case UPNPINOTIFY:
if( (strcmp(ary_options[i].value, "yes") != 0) && !atoi(ary_options[i].value) )
CLEARFLAG(INOTIFY_MASK);
@ -624,7 +636,7 @@ init(int argc, char * * argv)
#else
if( access(db_path, F_OK) != 0 )
make_dir(db_path, S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO);
sprintf(real_path, "%s/minidlna.log", db_path);
sprintf(real_path, "%s/minidlna.log", log_path);
log_init(real_path, "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn");
#endif
}

View File

@ -34,6 +34,7 @@ static const struct {
{ UPNPALBUMART_NAMES, "album_art_names"},
{ UPNPINOTIFY, "inotify" },
{ UPNPDBDIR, "db_dir" },
{ UPNPLOGDIR, "log_dir" },
{ ENABLE_TIVO, "enable_tivo" },
{ ENABLE_DLNA_STRICT, "strict_dlna" }
};

View File

@ -26,7 +26,8 @@ enum upnpconfigoptions {
UPNPMEDIADIR, /* directory to search for UPnP-A/V content */
UPNPALBUMART_NAMES, /* list of '/'-delimited file names to check for album art */
UPNPINOTIFY, /* enable inotify on the media directories */
UPNPDBDIR, /* base directory to store the database, log files, and album art cache */
UPNPDBDIR, /* base directory to store the database and album art cache */
UPNPLOGDIR, /* base directory to store the log file */
ENABLE_TIVO, /* enable support for streaming images and music to TiVo */
ENABLE_DLNA_STRICT /* strictly adhere to DLNA specs */
};

View File

@ -45,6 +45,7 @@ sqlite3 * db;
char dlna_no_conv[] = "DLNA.ORG_OP=01;DLNA.ORG_CI=0";
char friendly_name[FRIENDLYNAME_MAX_LEN];
char db_path[PATH_MAX] = DEFAULT_DB_PATH;
char log_path[PATH_MAX] = DEFAULT_LOG_PATH;
struct media_dir_s * media_dirs = NULL;
struct album_art_name_s * album_art_names = NULL;
struct client_cache_s clients[CLIENT_CACHE_SLOTS];

View File

@ -123,6 +123,7 @@ extern char dlna_no_conv[];
#define FRIENDLYNAME_MAX_LEN (64)
extern char friendly_name[];
extern char db_path[];
extern char log_path[];
extern struct media_dir_s * media_dirs;
extern struct album_art_name_s * album_art_names;
extern struct client_cache_s clients[CLIENT_CACHE_SLOTS];