[patch] small fix for ar.c

Geoff Keating geoffk@cygnus.com
Thu Aug 10 16:36:00 GMT 2000


> Date: Thu, 10 Aug 2000 17:41:00 -0400
> From: Jes Sorensen <jes@linuxcare.com>
> 
> Hi
> 
> ar.c from current CVS crashes when called without arguments because it
> tries to do a strcmp on argv[1] which is NULL.

Oops!

Your patch is not quite right, though.  We want to change the loop
to:

  while (argc > 1 && strcmp (argv[1], "-X32_64") == 0)
    {
      argv++;
      argc--;
    }

otherwise a simple 'ar -X32_64' will still crash.  Does that still
solve your problem?

> Jes
> 
> 2000-08-10  Jes Sorensen  <jes@linuxcare.com>
> 
> 	* ar.c (main): Only check for the -X32_64 option in argv[1+] if
> 	argc > 1 (strcmp does not like null pointers).


-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Binutils mailing list