summaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2000-06-20 12:33:20 +0000
committerAlan Modra <amodra@bigpond.net.au>2000-06-20 12:33:20 +0000
commit54e900c0e8d2804b4cf5836157954b5f8d81cd82 (patch)
tree6c9c0e802a7e416ef1f332b4cf0898364a8747b4 /bfd/archive.c
parentc19cfd9b7af06bc60a213433ad48789b425ebabc (diff)
downloadgdb-54e900c0e8d2804b4cf5836157954b5f8d81cd82.tar.gz
Correct pointer comparisons relying on NULL less than any other pointer.
Alexander Aganichev's fix for ieee.c
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 5709f26e272..6fe5997b7ab 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1188,7 +1188,7 @@ normalize (abfd, file)
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (file, '\\');
- if (bslash > filename)
+ if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && file[0] != '\0' && file[1] == ':')
filename = file + 1;
@@ -1581,7 +1581,7 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr)
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (pathname, '\\');
- if (bslash > filename)
+ if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
filename = pathname + 1;
@@ -1632,7 +1632,7 @@ bfd_gnu_truncate_arname (abfd, pathname, arhdr)
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (pathname, '\\');
- if (bslash > filename)
+ if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
filename = pathname + 1;