diff options
author | Justin Maggard <jmaggard@users.sourceforge.net> | 2011-03-12 05:17:27 +0300 |
---|---|---|
committer | Justin Maggard <jmaggard@users.sourceforge.net> | 2011-03-12 05:17:27 +0300 |
commit | 227b0f03f0de21de755bb7c1ad8cea9d9dbb194d (patch) | |
tree | eadc60d53d531c3ca1d97a2876d5723a7ea3a3b8 | |
parent | 45b91b6b27c0ed3bb778ccb29925bed22a5fa4ef (diff) |
* When called with -R, only remove art_cache and files.db in case users use an imporant directory as their db dir.v1.0.19
* Touch up log directory handling. If there is no log dir, but there is a db dir, store the log in the db dir.
-rw-r--r-- | minidlna.c | 11 | ||||
-rw-r--r-- | minidlna.conf | 3 | ||||
-rw-r--r-- | upnpglobalvars.c | 4 |
3 files changed, 15 insertions, 3 deletions
@@ -546,6 +546,15 @@ init(int argc, char * * argv) } } } + if( log_path[0] == '\0' ) + { + if( db_path[0] == '\0' ) + strncpy(log_path, DEFAULT_LOG_PATH, PATH_MAX); + else + strncpy(log_path, db_path, PATH_MAX); + } + if( db_path[0] == '\0' ) + strncpy(db_path, DEFAULT_DB_PATH, PATH_MAX); /* command line arguments processing */ for(i=1; i<argc; i++) @@ -676,7 +685,7 @@ init(int argc, char * * argv) runtime_vars.port = 0; // triggers help display break; case 'R': - snprintf(real_path, sizeof(real_path), "rm -rf %s/*", db_path); + snprintf(real_path, sizeof(real_path), "rm -rf %s/files.db %s/art_cache", db_path, db_path); system(real_path); break; case 'V': diff --git a/minidlna.conf b/minidlna.conf index 5a93936..f44c350 100644 --- a/minidlna.conf +++ b/minidlna.conf @@ -19,6 +19,9 @@ media_dir=/opt # set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache #db_dir=/var/cache/minidlna +# set this if you would like to specify the directory where you want MiniDLNA to store its log file +#log_dir=/var/log + # this should be a list of file names to check for when searching for album art # note: names should be delimited with a forward slash ("/") album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg diff --git a/upnpglobalvars.c b/upnpglobalvars.c index ad135e2..d059daa 100644 --- a/upnpglobalvars.c +++ b/upnpglobalvars.c @@ -84,8 +84,8 @@ struct lan_addr_s lan_addr[MAX_LAN_ADDR]; 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; +char db_path[PATH_MAX] = {'\0'}; +char log_path[PATH_MAX] = {'\0'}; struct media_dir_s * media_dirs = NULL; struct album_art_name_s * album_art_names = NULL; struct client_cache_s clients[CLIENT_CACHE_SLOTS]; |