Skip to content

Commit

Permalink
use memcpy() to cope with possible misalignment
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jul 7, 2012
1 parent d8a5b55 commit 330ff7e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libblkid/src/topology/topology.c
Expand Up @@ -222,14 +222,13 @@ static int topology_set_value(blkid_probe pr, const char *name,
return 0; /* ignore zeros */

if (chn->binary) {
unsigned long *v =
(unsigned long *) (chn->data + structoff);
*v = data;
memcpy(chn->data + structoff, &data, sizeof(data));
return 0;
}
return blkid_probe_sprintf_value(pr, name, "%llu", data);
}


/* the topology info is complete when we have at least "minimum_io_size" which
* is provided by all blkid topology drivers */
static int topology_is_complete(blkid_probe pr)
Expand Down

0 comments on commit 330ff7e

Please sign in to comment.