Stig Bjørlykke
changed
bug 7310
What |
Removed |
Added |
Status |
RESOLVED
|
INCOMPLETE
|
CC |
|
[email protected]
|
Resolution |
FIXED
|
---
|
Comment # 12
on bug 7310
from Stig Bjørlykke
I'm getting a warning on this code when compiling with clang:
packet-glusterfs.c:533:24: error: cast from 'gchar *' (aka 'char *') to
'e_guid_t *'
(aka 'struct _e_guid_t *') increases required alignment from 1 to 4
[-Werror,-Wcast-align]
gfid = guid_to_str((e_guid_t*) value);
^~~~~~~~~~~~~~~~~
1 error generated.
This is because you cast a char pointer (which may not be aligned) to a struct
(which has to be aligned on some platforms). This will lead to a crash on
those platforms.
But another problem here is that you use the hex variant of the GFID without
thinking about endian, so the GFID will be displayed different on machines with
different endian.
I'll suggest rewriting this code to "manually" fetch the hex values from the
string into a e_guid_t, converting them using the appropriate ntoh* functions.
Do you have a sample capture file with a hex variant of GFID which can be used
to test any code changes?
You are receiving this mail because:
- You are watching all bug changes.