[vlc-devel] commit: config: on OS X, don't use required_argument for getopt_long, but optional_argument. (Derk-Jan Hartman )
git version control
git at videolan.org
Tue Aug 12 13:12:26 CEST 2008
vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Tue Aug 12 13:06:39 2008 +0200| [c4523879615f253b2f939df334d2ff9eff14e690] | committer: 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
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c4523879615f253b2f939df334d2ff9eff14e690
---
src/config/cmdline.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/config/cmdline.c b/src/config/cmdline.c
index 4899129..4ea2e6a 100644
--- a/src/config/cmdline.c
+++ b/src/config/cmdline.c
@@ -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++;
More information about the vlc-devel
mailing list