File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -700,15 +700,15 @@ mender_client_initialization_work_function(void) {
700700    if  (MENDER_OK  !=  (ret  =  mender_storage_get_deployment_data (& deployment_data ))) {
701701        if  (MENDER_NOT_FOUND  !=  ret ) {
702702            mender_log_error ("Unable to get deployment data" );
703-             goto END ;
703+             goto REBOOT ;
704704        }
705705    }
706706    if  (NULL  !=  deployment_data ) {
707707        if  (NULL  ==  (mender_client_deployment_data  =  cJSON_Parse (deployment_data ))) {
708-             mender_log_error ("Unable to allocate memory " );
708+             mender_log_error ("Unable to parse deployment data " );
709709            free (deployment_data );
710710            ret  =  MENDER_FAIL ;
711-             goto END ;
711+             goto REBOOT ;
712712        }
713713        free (deployment_data );
714714    }
@@ -717,6 +717,18 @@ mender_client_initialization_work_function(void) {
717717
718718END :
719719
720+     return  ret ;
721+ 
722+ REBOOT :
723+ 
724+     /* Delete pending deployment */ 
725+     mender_storage_delete_deployment_data ();
726+ 
727+     /* Invoke restart callback, application is responsible to shutdown properly and restart the system */ 
728+     if  (NULL  !=  mender_client_callbacks .restart ) {
729+         mender_client_callbacks .restart ();
730+     }
731+ 
720732    return  ret ;
721733}
722734
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments