This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Fix two more ARFMAG typos


As part of some source cleanup unrelated to but part of the thin
archive patch to bfd/archive.c, several literal newlines were replaced
by mistake with ARFMAG[0] instead of ARFMAG[1]. These were fixed in a
subsequent patch. I just discovered two more instances of the original
typo in slightly different form (the following diff is excerpted from
the original patch):

@@ -1707,7 +1982,7 @@ _bfd_write_archive_contents (bfd *arch)
 	return FALSE;
       if ((elength % 2) == 1)
 	{
-	  if (bfd_bwrite ("\012", 1, arch) != 1)
+	  if (bfd_bwrite (ARFMAG, 1, arch) != 1)
 	    return FALSE;
 	}
     }

@@ -1742,9 +2021,10 @@ _bfd_write_archive_contents (bfd *arch)
 	    return FALSE;
 	  remaining -= amt;
 	}
+
       if ((arelt_size (current) % 2) == 1)
 	{
-	  if (bfd_bwrite ("\012", 1, arch) != 1)
+	  if (bfd_bwrite (ARFMAG, 1, arch) != 1)
 	    return FALSE;
 	}
     }

These will cause archives to be written with a backquote as the
padding character instead of a newline.

I'm committing the following patch as a trivial and obvious fix (I did
build and test):

        * archive.c (_bfd_write_archive_contents): Fix incorrect use of
        ARFMAG.

-cary


Index: archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.53
diff -u -p -r1.53 archive.c
--- archive.c	31 Mar 2008 23:44:47 -0000	1.53
+++ archive.c	22 Apr 2008 00:01:16 -0000
@@ -1982,7 +1982,7 @@ _bfd_write_archive_contents (bfd *arch)
 	return FALSE;
       if ((elength % 2) == 1)
 	{
-	  if (bfd_bwrite (ARFMAG, 1, arch) != 1)
+	  if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1)
 	    return FALSE;
 	}
     }
@@ -2024,7 +2024,7 @@ _bfd_write_archive_contents (bfd *arch)

       if ((arelt_size (current) % 2) == 1)
 	{
-	  if (bfd_bwrite (ARFMAG, 1, arch) != 1)
+	  if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1)
 	    return FALSE;
 	}
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]