i wonder if it would be simpler to convert xattr to a std::string and use std::string::compare (http://www.cplusplus.com/reference/string/string/compare/) (more or less equivalent to strcmp)