aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-06-20 12:33:21 +0000
committerAlan Modra <amodra@gmail.com>2000-06-20 12:33:21 +0000
commit2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575 (patch)
treef16dbfc601991f71c0177a7027479b3d3e3f9247
parentb305ef96a167be657a95d273db6945fe7597e937 (diff)
downloadbinutils-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.zip
binutils-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.tar.gz
binutils-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.tar.bz2
Correct pointer comparisons relying on NULL less than any other pointer.
Alexander Aganichev's fix for ieee.c
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/archive.c6
-rw-r--r--binutils/ChangeLog11
-rw-r--r--binutils/ar.c6
-rw-r--r--binutils/bucomm.c2
-rw-r--r--binutils/ieee.c8
-rw-r--r--gprof/ChangeLog5
-rw-r--r--gprof/source.c4
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/ldmain.c2
10 files changed, 42 insertions, 14 deletions
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 <alan@linuxcare.com.au>
+
+ * 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 <ulfc@engr.sgi.com>
* 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;
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 6bb13ff..ce7c8f5 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,14 @@
+2000-06-20 Alexander Aganichev <AAganichev@hypercom.com>
+
+ * ar.c (normalize): Correct pointer comparison when checking for
+ backslashes.
+ (main): Likewise.
+ * bucomm.c (make_tempname): Likewise.
+
+ * ieee.c (ieee_start_compilation_unit): Correct pointer comparison
+ and search for backslashes in the original pathname.
+ (ieee_add_bb11): Likewise.
+
2000-06-18 Nick Clifton <nickc@redhat.com>
* ar.c (print_contents): Improve verbose message.
diff --git a/binutils/ar.c b/binutils/ar.c
index cc8b77a..650092f 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -307,10 +307,10 @@ normalize (file, abfd)
{
/* 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;
+ filename = file + 1;
}
#endif
if (filename != (char *) NULL)
@@ -392,7 +392,7 @@ main (argc, argv)
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (program_name, '\\');
- if (bslash > temp)
+ if (temp == NULL || (bslash != NULL && bslash > temp))
temp = bslash;
if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':')
temp = program_name + 1;
diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index 76ffa60..86c327f 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -219,7 +219,7 @@ make_tempname (filename)
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (filename, '\\');
- if (bslash > slash)
+ if (slash == NULL || (bslash != NULL && bslash > slash))
slash = bslash;
if (slash == NULL && filename[0] != '\0' && filename[1] == ':')
slash = filename + 1;
diff --git a/binutils/ieee.c b/binutils/ieee.c
index 27409cc..44dd64f 100644
--- a/binutils/ieee.c
+++ b/binutils/ieee.c
@@ -4940,8 +4940,8 @@ ieee_start_compilation_unit (p, filename)
info->filename = filename;
modname = strrchr (filename, '/');
/* We could have a mixed forward/back slash case. */
- backslash = strrchr (modname, '\\');
- if (backslash > modname)
+ backslash = strrchr (filename, '\\');
+ if (modname == NULL || (backslash != NULL && backslash > modname))
modname = backslash;
if (modname != NULL)
@@ -5206,8 +5206,8 @@ ieee_add_bb11 (info, sec, low, high)
/* Start the enclosing BB10 block. */
filename = bfd_get_filename (info->abfd);
modname = strrchr (filename, '/');
- backslash = strrchr (modname, '\\');
- if (backslash > modname)
+ backslash = strrchr (filename, '\\');
+ if (modname == NULL || (backslash != NULL && backslash > modname))
modname = backslash;
if (modname != NULL)
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index deec805..400c834 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-20 Alan Modra <alan@linuxcare.com.au>
+
+ * source.c (annotate_source): Correct pointer comparison when
+ checking for backslashes.
+
2000-06-13 H.J. Lu <hjl@gnu.org>
* configure: Regenerate.
diff --git a/gprof/source.c b/gprof/source.c
index 039e876..dd671d5 100644
--- a/gprof/source.c
+++ b/gprof/source.c
@@ -116,7 +116,7 @@ DEFUN (annotate_source, (sf, max_width, annote, arg),
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
char *bslash = strrchr (sf->name, '\\');
- if (bslash > name_only)
+ if (name_only == NULL || (bslash != NULL && bslash > name_only))
name_only = bslash;
if (name_only == NULL && sf->name[0] != '\0' && sf->name[1] == ':')
name_only = (char *)sf->name + 1;
@@ -174,7 +174,7 @@ DEFUN (annotate_source, (sf, max_width, annote, arg),
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
char *bslash = strrchr (sf->name, '\\');
- if (bslash > filename)
+ if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && sf->name[0] != '\0' && sf->name[1] == ':')
filename = sf->name + 1;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 130c8dd..cc5df52 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-20 Alan Modra <alan@linuxcare.com.au>
+
+ * ldmain.c (set_scripts_dir): Correct pointer comparison when
+ checking for backslashes.
+
2000-06-19 Alan Modra <alan@linuxcare.com.au>
* NEWS: Move entries not in 2.10 above "Changes in version 2.10".
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 9cb55ed..660ea94 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -575,7 +575,7 @@ set_scripts_dir ()
{
/* We could have \foo\bar, or /foo\bar. */
char *bslash = strrchr (program_name, '\\');
- if (bslash > end)
+ if (end == NULL || (bslash != NULL && bslash > end))
end = bslash;
}
#endif