I can use GIO functions for creating and changing custom attributes in the “xattr” namespace, but I failed to find any GIO function for removing such an attribute.
If I try to remove the attribute by unsetting it, this does not work:
g_file_set_attribute(filedata, "xattr::customstring", G_FILE_ATTRIBUTE_TYPE_INVALID, NULL, G_FILE_QUERY_INFO_NONE, NULL, &error);
I get the error message: “Invalid attribute type (string expected)”. If I set the attribute type to string, but the pointer still is NULL, then the program crashes.
The only solution that I was able to find is the use of removexattr function:
But this means that my code becomes mixed: GIO functions are used along with glibc functions. Though, I cannot explain it exactly, I don’t like writing mixed code, where functions of different origin and abstraction level are applied to one and the same data set.