+ ret = lstat(pathname, st);
+ if (ret) {
+ fprintf(stderr, "%s: failed to stat '%s': %s\n",
+ progname, pathname, strerror(errno));
+ return -errno;
+ }
+
+ /* currently, only file and dir supported */
+ if (!S_ISREG(st->st_mode) && !S_ISDIR(st->st_mode)) {
+ errno = ENOTSUP;
+ fprintf(stderr, "%s: unable to get xattr for %s '%s': %s\n",
+ progname, mode_to_type(st->st_mode), pathname,
+ strerror(errno));
+ return -errno;
+ }
+