]> git.sesse.net Git - vlc/commitdiff
Fix a segfault which orrured when you set a schedule date with only a time like in...
authorAdrien Maglo <magsoft@videolan.org>
Wed, 30 Jul 2008 13:28:05 +0000 (15:28 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 30 Jul 2008 14:22:33 +0000 (16:22 +0200)
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: Rémi Duraffort <ivoire@videolan.org>
src/input/vlmshell.c

index 90c59d985f6ead7e0a1979ba8423ea3c781f36b4..0d8bc10e61e9a0d6301e3871ddb264adb31b8d5f 100644 (file)
@@ -621,7 +621,8 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
         if( !strcmp( ppsz_property[i], "enabled" ) ||
             !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" ) )
         {
@@ -641,7 +642,8 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
                 strcat( psz_line, ppsz_property[j] );
             }
 
-            vlm_ScheduleSetup( p_schedule, "append", psz_line );
+            if( vlm_ScheduleSetup( p_schedule, "append", psz_line ) )
+                goto error;
             break;
         }
         else
@@ -653,12 +655,18 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
                 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++;
         }
     }
     *pp_status = vlm_MessageNew( psz_cmd, vlm_NULL );
     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,
@@ -1056,9 +1064,7 @@ static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char *psz_cmd,
         {
             schedule->i_date = 0;
         }
-        else if( (p == NULL) && sscanf( psz_value, "%d:%d:%d", &time.tm_hour,
-                                        &time.tm_min, &time.tm_sec ) != 3 )
-                                        /* it must be a hour:minutes:seconds */
+        else if(p == NULL)
         {
             return 1;
         }