From 2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 20 Jun 2000 12:33:21 +0000 Subject: Correct pointer comparisons relying on NULL less than any other pointer. Alexander Aganichev's fix for ieee.c --- bfd/ChangeLog | 7 +++++++ bfd/archive.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2e2b187..30512d1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2000-06-20 Alan Modra + + * archive.c (normalize): Correct pointer comparison when checking + for backslashes. + (bfd_bsd_truncate_arname): Likewise. + (bfd_gnu_truncate_arname): Likewise. + 2000-06-20 Ulf Carlsson * elf-bfd.h (struct elf_obj_tdata): Define per BFD Irix 5 virtual diff --git a/bfd/archive.c b/bfd/archive.c index 5709f26..6fe5997 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; -- cgit v1.1