* Add checks and change behavior based the type of sqlite library we're linked to.
This commit is contained in:
parent
0d069effd9
commit
c643cab907
19
minidlna.c
19
minidlna.c
@ -665,6 +665,15 @@ main(int argc, char * * argv)
|
|||||||
unlink("/ramfs/.upnp-av_scan");
|
unlink("/ramfs/.upnp-av_scan");
|
||||||
#else
|
#else
|
||||||
DPRINTF(E_WARN, L_GENERAL, "Starting MiniDLNA version " MINIDLNA_VERSION " [SQLite %s].\n", sqlite3_libversion());
|
DPRINTF(E_WARN, L_GENERAL, "Starting MiniDLNA version " MINIDLNA_VERSION " [SQLite %s].\n", sqlite3_libversion());
|
||||||
|
if( !sqlite3_threadsafe() )
|
||||||
|
{
|
||||||
|
DPRINTF(E_ERROR, L_GENERAL, "SQLite library is not threadsafe! "
|
||||||
|
"Scanning must be finished before file serving can begin.\n");
|
||||||
|
}
|
||||||
|
if( sqlite3_libversion_number() < 3005009 )
|
||||||
|
{
|
||||||
|
DPRINTF(E_WARN, L_GENERAL, "SQLite library is old. Please use version 3.5.9 or newer.\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
LIST_INIT(&upnphttphead);
|
LIST_INIT(&upnphttphead);
|
||||||
|
|
||||||
@ -714,17 +723,25 @@ main(int argc, char * * argv)
|
|||||||
}
|
}
|
||||||
scanning = 1;
|
scanning = 1;
|
||||||
#if USE_FORK
|
#if USE_FORK
|
||||||
|
if( sqlite3_threadsafe() && sqlite3_libversion_number() >= 3005000 )
|
||||||
|
{
|
||||||
if( pthread_create(&thread[0], NULL, start_scanner, NULL) )
|
if( pthread_create(&thread[0], NULL, start_scanner, NULL) )
|
||||||
{
|
{
|
||||||
DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_scanner.\n");
|
DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_scanner.\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
start_scanner();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
start_scanner();
|
start_scanner();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
sqlite3_free_table(result);
|
sqlite3_free_table(result);
|
||||||
}
|
}
|
||||||
if( GETFLAG(INOTIFYMASK) && pthread_create(&thread[1], NULL, start_inotify, NULL) )
|
if( sqlite3_threadsafe() && sqlite3_libversion_number() >= 3005000 &&
|
||||||
|
GETFLAG(INOTIFYMASK) && pthread_create(&thread[1], NULL, start_inotify, NULL) )
|
||||||
{
|
{
|
||||||
DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_inotify.\n");
|
DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_inotify.\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user