Commit ba7c8a35 authored by Adrien Maglo's avatar Adrien Maglo Committed by Rémi Duraffort

Fix a segfault which orrured when you set a schedule date with only a time...

Fix a segfault which orrured when you set a schedule date with only a time like in : 'new test schedule date 18:00:00'
In fact, this was not supported and the test condition was wrong.

Also tell the user when the VLM couln't set a schedule property.
Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent fe8c4673
...@@ -621,7 +621,8 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule ...@@ -621,7 +621,8 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
if( !strcmp( ppsz_property[i], "enabled" ) || if( !strcmp( ppsz_property[i], "enabled" ) ||
!strcmp( ppsz_property[i], "disabled" ) ) !strcmp( ppsz_property[i], "disabled" ) )
{ {
vlm_ScheduleSetup( p_schedule, ppsz_property[i], NULL ); if ( vlm_ScheduleSetup( p_schedule, ppsz_property[i], NULL ) )
goto error;
} }
else if( !strcmp( ppsz_property[i], "append" ) ) else if( !strcmp( ppsz_property[i], "append" ) )
{ {
...@@ -641,7 +642,8 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule ...@@ -641,7 +642,8 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
strcat( psz_line, ppsz_property[j] ); strcat( psz_line, ppsz_property[j] );
} }
vlm_ScheduleSetup( p_schedule, "append", psz_line ); if( vlm_ScheduleSetup( p_schedule, "append", psz_line ) )
goto error;
break; break;
} }
else else
...@@ -653,12 +655,18 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule ...@@ -653,12 +655,18 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
return ExecuteSyntaxError( psz_cmd, pp_status ); return ExecuteSyntaxError( psz_cmd, pp_status );
} }
vlm_ScheduleSetup( p_schedule, ppsz_property[i], ppsz_property[i+1] ); if( vlm_ScheduleSetup( p_schedule, ppsz_property[i], ppsz_property[i+1] ) )
goto error;
i++; i++;
} }
} }
*pp_status = vlm_MessageNew( psz_cmd, vlm_NULL ); *pp_status = vlm_MessageNew( psz_cmd, vlm_NULL );
return VLC_SUCCESS; return VLC_SUCCESS;
error:
*pp_status = vlm_MessageNew( psz_cmd, "Error while setting the property '%s' to the schedule",
ppsz_property[i] );
return VLC_EGENERIC;
} }
static int ExecuteMediaProperty( vlm_t *p_vlm, int64_t id, bool b_new, static int ExecuteMediaProperty( vlm_t *p_vlm, int64_t id, bool b_new,
...@@ -1056,9 +1064,7 @@ static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char *psz_cmd, ...@@ -1056,9 +1064,7 @@ static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char *psz_cmd,
{ {
schedule->i_date = 0; schedule->i_date = 0;
} }
else if( (p == NULL) && sscanf( psz_value, "%d:%d:%d", &time.tm_hour, else if(p == NULL)
&time.tm_min, &time.tm_sec ) != 3 )
/* it must be a hour:minutes:seconds */
{ {
return 1; return 1;
} }
......
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