Skip to content

Commit

Permalink
libtool/ranlib - Only check the end of the name to determine that we'…
Browse files Browse the repository at this point in the history
…re invoking as ranlib. This allows names such as powerpc-apple-darwin9-ranlib.
  • Loading branch information
iains committed May 14, 2016
1 parent a10155b commit 6bbb627
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cctools/misc/libtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,15 @@ static uint32_t trnc(
/* apple_version is in vers.c which is created by the libstuff/Makefile */
extern char apple_version[];

#define RSZ (sizeof("ranlib")-1)
int
main(
int argc,
char **argv,
char **envp)
{
char *p, *endp, *filelist, *dirname, *addr;
int fd, i;
int fd, i, len, sz;
struct stat stat_buf;
uint32_t j, nfiles, maxfiles;
uint32_t temp;
Expand Down Expand Up @@ -382,8 +383,12 @@ char **envp)
p++;
else
p = argv[0];
if(strncmp(p, "ranlib", sizeof("ranlib") - 1) == 0)
cmd_flags.ranlib = TRUE;

len = strlen(p);
/* If the name by which this was invoked ends in 'ranlib' then we are in
ranlib mode. */
if(len >= RSZ && strncmp(p+len-RSZ, "ranlib", RSZ) == 0)
cmd_flags.ranlib = TRUE;

/* The default is to used long names */
cmd_flags.use_long_names = TRUE;
Expand Down

0 comments on commit 6bbb627

Please sign in to comment.