@@ -1604,9 +1604,9 @@ read_container_config_from_state (libcrun_container_t **container, const char *s
16041604
16051605 * container = NULL ;
16061606
1607- dir = libcrun_get_state_directory (state_root , id );
1608- if (UNLIKELY (dir == NULL ))
1609- return crun_make_error ( err , 0 , "cannot get state directory from `%s`" , state_root ) ;
1607+ ret = libcrun_get_state_directory (& dir , state_root , id , err );
1608+ if (UNLIKELY (ret < 0 ))
1609+ return ret ;
16101610
16111611 ret = append_paths (& config_file , err , dir , "config.json" , NULL );
16121612 if (UNLIKELY (ret < 0 ))
@@ -2041,9 +2041,9 @@ wait_for_process (struct wait_for_process_args *args, libcrun_error_t *err)
20412041 struct libcrun_load_seccomp_notify_conf_s conf ;
20422042 memset (& conf , 0 , sizeof conf );
20432043
2044- state_root = libcrun_get_state_directory (args -> context -> state_root , args -> context -> id );
2045- if (UNLIKELY (state_root == NULL ))
2046- return crun_make_error ( err , 0 , "cannot get state directory" ) ;
2044+ ret = libcrun_get_state_directory (& state_root , args -> context -> state_root , args -> context -> id , err );
2045+ if (UNLIKELY (ret < 0 ))
2046+ return ret ;
20472047
20482048 ret = append_paths (& oci_config_path , err , state_root , "config.json" , NULL );
20492049 if (UNLIKELY (ret < 0 ))
@@ -2777,9 +2777,9 @@ libcrun_copy_config_file (const char *id, const char *state_root, libcrun_contai
27772777 cleanup_free char * buffer = NULL ;
27782778 size_t len ;
27792779
2780- dir = libcrun_get_state_directory (state_root , id );
2781- if (UNLIKELY (dir == NULL ))
2782- return crun_make_error ( err , 0 , "cannot get state directory" ) ;
2780+ ret = libcrun_get_state_directory (& dir , state_root , id , err );
2781+ if (UNLIKELY (ret < 0 ))
2782+ return ret ;
27832783
27842784 ret = append_paths (& dest_path , err , dir , "config.json" , NULL );
27852785 if (UNLIKELY (ret < 0 ))
@@ -3259,12 +3259,9 @@ libcrun_container_state (libcrun_context_t *context, const char *id, FILE *out,
32593259 cleanup_container libcrun_container_t * container = NULL ;
32603260 cleanup_free char * dir = NULL ;
32613261
3262- dir = libcrun_get_state_directory (state_root , id );
3263- if (UNLIKELY (dir == NULL ))
3264- {
3265- ret = crun_make_error (err , 0 , "cannot get state directory" );
3266- goto exit ;
3267- }
3262+ ret = libcrun_get_state_directory (& dir , state_root , id , err );
3263+ if (UNLIKELY (ret < 0 ))
3264+ goto exit ;
32683265
32693266 ret = append_paths (& config_file , err , dir , "config.json" , NULL );
32703267 if (UNLIKELY (ret < 0 ))
@@ -3598,9 +3595,9 @@ libcrun_container_exec_with_options (libcrun_context_t *context, const char *id,
35983595 return ret ;
35993596 container_status = ret ;
36003597
3601- dir = libcrun_get_state_directory (state_root , id );
3602- if (UNLIKELY (dir == NULL ))
3603- return crun_make_error ( err , 0 , "cannot get state directory" ) ;
3598+ ret = libcrun_get_state_directory (& dir , state_root , id , err );
3599+ if (UNLIKELY (ret < 0 ))
3600+ return ret ;
36043601
36053602 ret = append_paths (& config_file , err , dir , "config.json" , NULL );
36063603 if (UNLIKELY (ret < 0 ))
@@ -4474,9 +4471,9 @@ libcrun_container_update_intel_rdt (libcrun_context_t *context, const char *id,
44744471 cleanup_free char * dir = NULL ;
44754472 int ret ;
44764473
4477- dir = libcrun_get_state_directory (context -> state_root , id );
4478- if (UNLIKELY (dir == NULL ))
4479- return crun_make_error ( err , 0 , "cannot get state directory" ) ;
4474+ ret = libcrun_get_state_directory (& dir , context -> state_root , id , err );
4475+ if (UNLIKELY (ret < 0 ))
4476+ return ret ;
44804477
44814478 ret = append_paths (& config_file , err , dir , "config.json" , NULL );
44824479 if (UNLIKELY (ret < 0 ))
0 commit comments