Commit c4523879 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

config: on OS X, don't use required_argument for getopt_long, but optional_argument.

required_argument is not implemented (behaves like optional_argument), and actually crashes in some instances.
This fixes a crash as detailed in #1681.
The problem is filed with Apple as Radar ticket 6113829
parent 7758e05f
......@@ -165,8 +165,14 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc,
p_longopts[i_index].name = strdup( p_item->psz_name );
if( p_longopts[i_index].name == NULL ) continue;
p_longopts[i_index].has_arg =
(p_item->i_type == CONFIG_ITEM_BOOL)?
no_argument : required_argument;
(p_item->i_type == CONFIG_ITEM_BOOL) ? no_argument :
#ifndef __APPLE__
required_argument;
#else
/* It seems that required_argument is broken on Darwin.
* Radar ticket #6113829 */
optional_argument;
#endif
p_longopts[i_index].flag = &flag;
p_longopts[i_index].val = 0;
i_index++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment