@@ -2205,8 +2205,8 @@ static int context_read_definitions(Context *context) {
22052205 if (q ) {
22062206 if (q -> priority != p -> priority )
22072207 return log_syntax (NULL , LOG_ERR , p -> definition_path , 1 , SYNTHETIC_ERRNO (EINVAL ),
2208- "Priority mismatch (%i != %i) for verity sibling partitions with VerityMatchKey=%s" ,
2209- p -> priority , q -> priority , p -> verity_match_key );
2208+ "Priority mismatch (%i != %i) for verity sibling partitions with VerityMatchKey=%s" ,
2209+ p -> priority , q -> priority , p -> verity_match_key );
22102210
22112211 p -> siblings [mode ] = q ;
22122212 }
@@ -2331,7 +2331,7 @@ static int context_load_partition_table(Context *context) {
23312331 return r ;
23322332
23332333 if (fstat (context -> backing_fd , & st ) < 0 )
2334- return log_error_errno (r , "Failed to stat %s: %m" , context -> node );
2334+ return log_error_errno (errno , "Failed to stat %s: %m" , context -> node );
23352335
23362336 /* Auto-detect sector size if not specified. */
23372337 r = probe_sector_size_prefer_ioctl (context -> backing_fd , & ssz );
@@ -3194,13 +3194,13 @@ static int context_wipe_range(Context *context, uint64_t offset, uint64_t size)
31943194 errno = 0 ;
31953195 r = blkid_do_probe (probe );
31963196 if (r < 0 )
3197- return log_error_errno (errno ?: SYNTHETIC_ERRNO (EIO ), "Failed to probe for file systems." );
3197+ return log_error_errno (errno_or_else (EIO ), "Failed to probe for file systems." );
31983198 if (r > 0 )
31993199 break ;
32003200
32013201 errno = 0 ;
32023202 if (blkid_do_wipe (probe , false) < 0 )
3203- return log_error_errno (errno ?: SYNTHETIC_ERRNO (EIO ), "Failed to wipe file system signature." );
3203+ return log_error_errno (errno_or_else (EIO ), "Failed to wipe file system signature." );
32043204 }
32053205
32063206 return 0 ;
@@ -3530,7 +3530,7 @@ static int prepare_temporary_file(PartitionTarget *t, uint64_t size) {
35303530
35313531 if (ftruncate (fd , size ) < 0 )
35323532 return log_error_errno (errno , "Failed to truncate temporary file to %s: %m" ,
3533- FORMAT_BYTES (size ));
3533+ FORMAT_BYTES (size ));
35343534
35353535 t -> fd = TAKE_FD (fd );
35363536 t -> path = TAKE_PTR (temp );
@@ -3711,9 +3711,8 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta
37113711
37123712 /* Weird cryptsetup requirement which requires the header file to be the size of at least one
37133713 * sector. */
3714- r = ftruncate (fileno (h ), luks_params .sector_size );
3715- if (r < 0 )
3716- return log_error_errno (r , "Failed to grow temporary LUKS header file: %m" );
3714+ if (ftruncate (fileno (h ), luks_params .sector_size ) < 0 )
3715+ return log_error_errno (errno , "Failed to grow temporary LUKS header file: %m" );
37173716 } else {
37183717 if (asprintf (& dm_name , "luks-repart-%08" PRIx64 , random_u64 ()) < 0 )
37193718 return log_oom ();
@@ -3746,14 +3745,15 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta
37463745 return log_error_errno (r , "Failed to set data offset: %m" );
37473746 }
37483747
3749- r = sym_crypt_format (cd ,
3750- CRYPT_LUKS2 ,
3751- "aes" ,
3752- "xts-plain64" ,
3753- SD_ID128_TO_UUID_STRING (p -> luks_uuid ),
3754- NULL ,
3755- VOLUME_KEY_SIZE ,
3756- & luks_params );
3748+ r = sym_crypt_format (
3749+ cd ,
3750+ CRYPT_LUKS2 ,
3751+ "aes" ,
3752+ "xts-plain64" ,
3753+ SD_ID128_TO_UUID_STRING (p -> luks_uuid ),
3754+ NULL ,
3755+ VOLUME_KEY_SIZE ,
3756+ & luks_params );
37573757 if (r < 0 )
37583758 return log_error_errno (r , "Failed to LUKS2 format future partition: %m" );
37593759
@@ -4547,7 +4547,7 @@ static int do_copy_files(Context *context, Partition *p, const char *root) {
45474547
45484548 rfd = open (root , O_DIRECTORY |O_CLOEXEC |O_NOFOLLOW );
45494549 if (rfd < 0 )
4550- return rfd ;
4550+ return - errno ;
45514551
45524552 sfd = chase_and_open (* source , arg_copy_source , CHASE_PREFIX_ROOT , O_PATH |O_DIRECTORY |O_CLOEXEC |O_NOCTTY , NULL );
45534553 if (sfd < 0 )
@@ -6359,7 +6359,7 @@ static int context_minimize(Context *context) {
63596359 return log_error_errno (errno , "Failed to open temporary file %s: %m" , temp );
63606360
63616361 if (fstat (fd , & st ) < 0 )
6362- return log_error_errno (r , "Failed to stat temporary file: %m" );
6362+ return log_error_errno (errno , "Failed to stat temporary file: %m" );
63636363
63646364 log_info ("Minimal partition size of verity hash partition %s is %s" ,
63656365 strna (hint ), FORMAT_BYTES (st .st_size ));
@@ -7569,7 +7569,7 @@ static int run(int argc, char *argv[]) {
75697569
75707570 r = search_and_access (d , F_OK , arg_root , CONF_PATHS_USR_STRV ("systemd/repart/definitions" ), & dp );
75717571 if (r < 0 )
7572- return log_error_errno (errno , "DDI type '%s' is not defined: %m" , arg_make_ddi );
7572+ return log_error_errno (r , "DDI type '%s' is not defined: %m" , arg_make_ddi );
75737573
75747574 if (strv_consume (& arg_definitions , TAKE_PTR (dp )) < 0 )
75757575 return log_oom ();
0 commit comments