This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
Problems with tftp on ARM systems...
- To: libc-hacker@cygnus.com
- Subject: Problems with tftp on ARM systems...
- From: Scott Bambrough <scottb@corelcomputer.com>
- Date: Mon, 29 Mar 1999 11:24:10 -0500
- Organization: Corel Computer Corporation
Using the tftphdr structure in ./inet/arpa/tftp.h on the ARM yields incorrect
results due to the alignment of data on the ARM. The structure as it comes
across the network is 5 bytes of packed data, while the struct on the ARM has
padding after the initial short, after the union, and at the end of the struct
to pad it out to an even number of words in length.
Adding __attribute__ ((packed)) to the struct as shown below fixes the problem.
typedef struct {
short th_opcode;
union {
unsigned short tu_block;
short tu_code;
char tu_stuff[1];
} __attribute__ ((packed)) th_u
char th_data[1] __attribute__ ((packed));
} __attribute__ ((packed)) tftphdr;
The structure is not in an ARM specific header file. If I submit a patch to
alter this header in this manner will it affect any of the other ports? Does
anyone have another better solution?
Scott