Libvlc:: daemon mode on for wrong cmd args
Posted: 22 Aug 2008 12:36
Just to document one strange behaivour that obscures bug finding.
Scenario:
0. Use Linux system VLC0.9
1. Use a c/c++ program and try to initialize libvlc but put a wrong argument (e.g. -no-audio instead of --no-audio)
2. Run your program within a command prompt and observe it exiting without any error message about the wrong arg [Yes i can see other debug msgs when libvlc has inited]
3. Optional : test the same initialization commands with vlc to check that here an error is reported before exiting
Catch ::
In a strange manner when the above scenario happens libvlc "daemon" config option becomes true !!!
Thus as we can see @src/libvlc.c@340
The second zero means redirect all output to /dev/null
Thats why we cannot see the error msg.
Confimed by changing the second arg to 1 and observing usefull debug logs.
The caveat is why libvlc tries to be on daemon mode ?? (also tried --no-daemon as initialization command -and the erroneus one- but not changed anything).
Probably when we have cmdline error some defaults are loaded??
Or libvlc defaults to daemon mode ??
if it is the second case should you change the second arg of daemon to be 0 **only** when we specify --quiet on cmdline and 1 by default ?
Scenario:
0. Use Linux system VLC0.9
1. Use a c/c++ program and try to initialize libvlc but put a wrong argument (e.g. -no-audio instead of --no-audio)
2. Run your program within a command prompt and observe it exiting without any error message about the wrong arg [Yes i can see other debug msgs when libvlc has inited]
3. Optional : test the same initialization commands with vlc to check that here an error is reported before exiting
Code: Select all
libvlc: unknown option or missing mandatory argument `-n'
In a strange manner when the above scenario happens libvlc "daemon" config option becomes true !!!
Thus as we can see @src/libvlc.c@340
Code: Select all
if( daemon( 1, 0) != 0 )
Thats why we cannot see the error msg.
Confimed by changing the second arg to 1 and observing usefull debug logs.
The caveat is why libvlc tries to be on daemon mode ?? (also tried --no-daemon as initialization command -and the erroneus one- but not changed anything).
Probably when we have cmdline error some defaults are loaded??
Or libvlc defaults to daemon mode ??
if it is the second case should you change the second arg of daemon to be 0 **only** when we specify --quiet on cmdline and 1 by default ?