This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] small fix for ar.c
- To: binutils at sourceware dot cygnus dot com
- Subject: [patch] small fix for ar.c
- From: Jes Sorensen <jes at linuxcare dot com>
- Date: Thu, 10 Aug 2000 17:41:00 -0400
Hi
ar.c from current CVS crashes when called without arguments because it
tries to do a strcmp on argv[1] which is NULL.
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).
--- ar.c.old Thu Aug 10 23:37:11 2000
+++ ar.c Thu Aug 10 18:22:34 2000
@@ -437,10 +437,13 @@
of object files in the archive (the 64-bit objects
or the 32-bit objects). GNU ar always looks at all
kinds of objects in an archive. */
- while (strcmp (argv[1], "-X32_64") == 0)
+ if (argc > 1)
{
- argv++;
- argc--;
+ while (strcmp (argv[1], "-X32_64") == 0)
+ {
+ argv++;
+ argc--;
+ }
}
if (is_ranlib)