libs/lmo: fix lmo_read32() (dereferencing type-punned pointer will break strict-aliasing rules)

This commit is contained in:
Jo-Philipp Wich 2009-07-30 11:06:12 +00:00
parent a6309fbeb8
commit 8c8ecd1fa9

View file

@ -22,13 +22,10 @@ extern char _lmo_error[1024];
static int lmo_read32( int fd, uint32_t *val )
{
uint8_t buffer[5];
if( read(fd, buffer, 4) < 4 )
if( read(fd, val, 4) < 4 )
return -1;
buffer[4] = 0;
*val = ntohl(*((uint32_t *) buffer));
*val = ntohl(*val);
return 4;
}