diff --git a/tools/stat.cpp b/tools/stat.cpp index 2446b3c..b16eef0 100644 --- a/tools/stat.cpp +++ b/tools/stat.cpp @@ -120,7 +120,12 @@ void do_xattr (char const *path) while (true) { auto const res = getxattr (path, keybuffer.c_str (), val.data (), val.size ()); - if (res == E2BIG) { + if (res < 0 && errno == E2BIG) { + val = "___E2BIG"; + break; + } + + if (res < 0 && errno == ERANGE) { val.resize (val.size () * 2); continue; }