Skip to content

Commit a9d47c1

Browse files
committed
Do not warn when setting the best-fit flag for SLBs, since that is
required for them
1 parent d595f7c commit a9d47c1

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/flags.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,6 @@ warning: changing the shared text flag is dangerous"));
334334
error (EXIT_SUCCESS, 0, _("\
335335
(it normally requires recompilation)."));
336336
}
337-
if (!BE_SILENT && plus_bestfit)
338-
{
339-
error (EXIT_SUCCESS, 0, _("\
340-
warning: changing the bestfit flag is dangerous"));
341-
}
342337

343338
/* Calculate flags. */
344339
if (has_flags)
@@ -406,13 +401,21 @@ warning: changing the bestfit flag is dangerous"));
406401
for (i = fileind; i < lastind; i++)
407402
{
408403
const char *filename = files[i];
409-
struct mintbin_target* target = open_target (filename,
410-
(do_print ?
411-
O_RDONLY : O_RDWR) | O_BINARY);
404+
struct mintbin_target* target;
412405
unsigned long new_flags;
413406
char cflags[4];
414407
int had_error = 0;
415408

409+
if (!BE_SILENT && plus_bestfit)
410+
{
411+
char *p = strrchr(filename, '.');
412+
if (p == NULL || strcasecmp(p, ".slb") != 0)
413+
error (EXIT_SUCCESS, 0, _("\
414+
%s: warning: changing the bestfit flag is dangerous"), filename);
415+
}
416+
417+
target = open_target (filename, (do_print ? O_RDONLY : O_RDWR) | O_BINARY);
418+
416419
if (target == NULL)
417420
{
418421
status = EXIT_FAILURE;

0 commit comments

Comments
 (0)