summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-06 10:53:49 +0100
committerwm4 <wm4@nowhere>2015-03-06 11:31:05 +0100
commit90496f3088fb635916fd97ffa5bcdc57d281e1ca (patch)
tree8e87756be2c94033e62b3dda9633fe37c7b4b142 /options
parent4dd7104af8f8ff10a81d6e9944e50a62f7b7e04f (diff)
downloadmpv-90496f3088fb635916fd97ffa5bcdc57d281e1ca.tar.bz2
mpv-90496f3088fb635916fd97ffa5bcdc57d281e1ca.tar.xz
player: fix operation if command line is empty
main() being called with argc==0 is probably possible. Fix by skipping the program name early. (I already changed and reverted this once, but this time we make sure that it's less likely to confuse the skipped argv with main()'s argv by naming it "options".)
Diffstat (limited to 'options')
-rw-r--r--options/parse_commandline.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/options/parse_commandline.c b/options/parse_commandline.c
index 06a6cb639b..6898075430 100644
--- a/options/parse_commandline.c
+++ b/options/parse_commandline.c
@@ -142,7 +142,7 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
mode = GLOBAL;
- struct parse_state p = {config, argv + 1};
+ struct parse_state p = {config, argv};
while (split_opt(&p)) {
if (p.is_opt) {
int flags = M_SETOPT_FROM_CMDLINE;
@@ -286,7 +286,7 @@ void m_config_preparse_command_line(m_config_t *config, struct mpv_global *globa
// Hack to shut up parser error messages
mp_msg_mute(global, true);
- struct parse_state p = {config, argv + 1};
+ struct parse_state p = {config, argv};
while (split_opt_silent(&p) == 0) {
if (p.is_opt) {
// Ignore non-pre-parse options. They will be set later.