Hello Xavier, now adding gluster-devel
😉 Von: Xavi Hernandez [mailto:jahernan@xxxxxxxxxx] Hi David, adding again gluster-devel. On Tue, Jan 9, 2018 at 4:15 PM, David Spisla <david.spisla@xxxxxxxxxxxx> wrote:
First of all, you should always use memory allocation functions from gluster. This includes GF_MALLOC(), gf_strdup(), gf_asprintf() and several other variants. You can look at libglusterfs/src/mem-pool.h to see all available options. The second problem I see is that memcpy() doesn't write a terminating null character, so when you compute strlen() afterwards, it will return invalid length, or even try to access invalid memory, causing a crash. You should do something like this (assuming both loc->path and loc->name are not NULL and skipping many necessary checks):
This should work fine. Xavi [David Spisla] Yes, this worls fine. Thank you 😊. By the way, is there a way inside gluster xlator to get access to xattr or attr of a file.
In the lookup function there is only the struct loc, but I am missing there the files gfid. It seems to be null always. I could use syncop_getxattr() with the parameter loc, but the gfid is missing. Can I get the gfid if I have only loc->path and loc-> name?
It is like a conversion from files path to files gfid. David
|
_______________________________________________ Gluster-devel mailing list Gluster-devel@xxxxxxxxxxx http://lists.gluster.org/mailman/listinfo/gluster-devel