Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforge.net>2010-10-27 04:51:39 +0400
committerJustin Maggard <jmaggard@users.sourceforge.net>2010-10-27 04:51:39 +0400
commit3fbd2ddcb799611de2a501be085d43f87123be1e (patch)
treeb1356cb3e019ea74e29e1c21ed44da855635c057
parent086080191ba00adbf4a9d77b2167baf80281a081 (diff)
* Add a separate option log_dir for the log directory.
-rwxr-xr-xgenconfig.sh7
-rw-r--r--minidlna.c14
-rw-r--r--options.c1
-rw-r--r--options.h3
-rw-r--r--upnpglobalvars.c1
-rw-r--r--upnpglobalvars.h1
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}
diff --git a/minidlna.c b/minidlna.c
index 2971364..c555256 100644
--- a/minidlna.c
+++ b/minidlna.c
@@ -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
}
diff --git a/options.c b/options.c
index 144b1a2..c3b3d7f 100644
--- a/options.c
+++ b/options.c
@@ -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" }
};
diff --git a/options.h b/options.h
index 4d9ceb2..e3ef97a 100644
--- a/options.h
+++ b/options.h
@@ -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];