aboutsummaryrefslogtreecommitdiffstats
path: root/include/ar.h
diff options
context:
space:
mode:
authorJoseph Koshy <jkoshy@FreeBSD.org>2006-11-13 04:28:29 +0000
committerJoseph Koshy <jkoshy@FreeBSD.org>2006-11-13 04:28:29 +0000
commit9e1ea8f2fe94851902ec6e954b9f3473c7564f4a (patch)
treec6d1a369a4c09f4db4e1f967829ce9508a5a2273 /include/ar.h
parent80ca751b22209fdc68b4a924c58a53bbe0185d60 (diff)
downloadsrc-9e1ea8f2fe94851902ec6e954b9f3473c7564f4a.tar.gz
src-9e1ea8f2fe94851902ec6e954b9f3473c7564f4a.zip
Attempt to improve application portability by marking `struct ar_hdr'
as `packed'. The C standard leaves the alignment of individual members of a C struct upto the implementation, so pedantically speaking portable code cannot assume that the layout of a `struct ar_hdr' in memory will match its layout in a file. Using a __packed attribute declaration forces file and memory layouts for this structure to match. Submitted by: ru
Notes
Notes: svn path=/head/; revision=164244
Diffstat (limited to 'include/ar.h')
-rw-r--r--include/ar.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/ar.h b/include/ar.h
index e04874fcbda3..40b4d74b04c6 100644
--- a/include/ar.h
+++ b/include/ar.h
@@ -39,11 +39,15 @@
* SUCH DAMAGE.
*
* @(#)ar.h 8.2 (Berkeley) 1/21/94
+ *
+ * $FreeBSD$
*/
#ifndef _AR_H_
#define _AR_H_
+#include <sys/cdefs.h>
+
/* Pre-4BSD archives had these magic numbers in them. */
#define OARMAG1 0177555
#define OARMAG2 0177545
@@ -62,6 +66,6 @@ struct ar_hdr {
char ar_size[10]; /* size in bytes */
#define ARFMAG "`\n"
char ar_fmag[2]; /* consistency check */
-};
+} __packed;
#endif /* !_AR_H_ */