@@ -209,6 +209,7 @@ int main(int argc, char *argv[])
209209 int cmd = CMD_NONE ;
210210 int stdout_fd ;
211211 char footer_location [256 ];
212+ int found_footer_location ;
212213 struct fstab * fstab ;
213214 struct fstab_part * p ;
214215 char * argument = NULL ;
@@ -264,16 +265,19 @@ int main(int argc, char *argv[])
264265 goto exit ;
265266 }
266267
267- strcpy ( footer_location , "" ) ;
268+ found_footer_location = 0 ;
268269
269- if (p -> options != NULL && get_footer_from_opts (footer_location ,
270- sizeof (footer_location ), p -> options ) < 0 )
271- goto exit ;
270+ if (p -> options )
271+ found_footer_location = get_footer_from_opts (footer_location , sizeof (footer_location ), p -> options ) == 0 ;
272+
273+ if (!found_footer_location && p -> options2 )
274+ found_footer_location = get_footer_from_opts (footer_location , sizeof (footer_location ), p -> options2 ) == 0 ;
272275
273- if (p -> options2 != NULL && strcmp ( footer_location , "" ) == 0 &&
274- get_footer_from_opts ( footer_location , sizeof ( footer_location ),
275- p -> options2 ) < 0 )
276+ if (! found_footer_location )
277+ {
278+ ERROR ( "Failed to find footer location\n" );
276279 goto exit ;
280+ }
277281
278282 INFO ("Setting encrypted partition data to %s %s %s\n" , p -> device , footer_location , p -> type );
279283 set_partition_data (p -> device , footer_location , p -> type );
0 commit comments