File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -530,6 +530,12 @@ static int boot_entry_compare(const BootEntry *a, const BootEntry *b) {
530530 assert (a );
531531 assert (b );
532532
533+ /* This mimics a function of the same name in src/boot/efi/sd-boot.c */
534+
535+ r = CMP (a -> tries_left == 0 , b -> tries_left == 0 );
536+ if (r != 0 )
537+ return r ;
538+
533539 r = CMP (!a -> sort_key , !b -> sort_key );
534540 if (r != 0 )
535541 return r ;
@@ -548,7 +554,18 @@ static int boot_entry_compare(const BootEntry *a, const BootEntry *b) {
548554 return r ;
549555 }
550556
551- return - strverscmp_improved (a -> id , b -> id );
557+ r = - strverscmp_improved (a -> id , b -> id );
558+ if (r != 0 )
559+ return r ;
560+
561+ if (a -> tries_left != UINT_MAX || b -> tries_left != UINT_MAX )
562+ return 0 ;
563+
564+ r = - CMP (a -> tries_left , b -> tries_left );
565+ if (r != 0 )
566+ return r ;
567+
568+ return CMP (a -> tries_done , b -> tries_done );
552569}
553570
554571static int config_check_inode_relevant_and_unseen (BootConfig * config , int fd , const char * fname ) {
You can’t perform that action at this time.
0 commit comments