diff options
author | Justin Maggard <jmaggard@users.sourceforge.net> | 2010-10-27 04:51:39 +0400 |
---|---|---|
committer | Justin Maggard <jmaggard@users.sourceforge.net> | 2010-10-27 04:51:39 +0400 |
commit | 3fbd2ddcb799611de2a501be085d43f87123be1e (patch) | |
tree | b1356cb3e019ea74e29e1c21ed44da855635c057 | |
parent | 086080191ba00adbf4a9d77b2167baf80281a081 (diff) |
* Add a separate option log_dir for the log directory.
-rwxr-xr-x | genconfig.sh | 7 | ||||
-rw-r--r-- | minidlna.c | 14 | ||||
-rw-r--r-- | options.c | 1 | ||||
-rw-r--r-- | options.h | 3 | ||||
-rw-r--r-- | upnpglobalvars.c | 1 | ||||
-rw-r--r-- | upnpglobalvars.h | 1 |
6 files changed, 25 insertions, 2 deletions
diff --git a/genconfig.sh b/genconfig.sh index 1b03d49..751d1db 100755 --- a/genconfig.sh +++ b/genconfig.sh @@ -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} @@ -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 } @@ -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" } }; @@ -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 */ }; diff --git a/upnpglobalvars.c b/upnpglobalvars.c index c6eade7..ed47e51 100644 --- a/upnpglobalvars.c +++ b/upnpglobalvars.c @@ -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]; diff --git a/upnpglobalvars.h b/upnpglobalvars.h index edf2ae7..58776b0 100644 --- a/upnpglobalvars.h +++ b/upnpglobalvars.h @@ -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]; |