2 * Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation, either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #include <sys/types.h>
24 #include <sys/xattr.h>
26 int main(int argc, char **argv)
33 fprintf(stderr, "usage: %s <testfile> [bufsize]\n", argv[0]);
38 bufsize = strtoul(argv[2], NULL, 10);
46 bufsize = listxattr(argv[1], NULL, 0);
53 buf = malloc(bufsize);
59 ret = listxattr(argv[1], buf, bufsize);
64 while (l < (buf + ret)) {
65 printf("xattr: %s\n", l);
66 l = strchr(l, '\0') + 1;