Libvlc:: daemon mode on for wrong cmd args

*nix specific usage questions
basos
Blank Cone
Blank Cone
Posts: 24
Joined: 17 Jul 2008 14:19

Libvlc:: daemon mode on for wrong cmd args

Postby basos » 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

Code: Select all

libvlc: unknown option or missing mandatory argument `-n'
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

Code: Select all

if( daemon( 1, 0) != 0 )
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 ?

Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 5 guests