ALT Linux Bugzilla
– Attachment 8336 Details for
Bug 37216
Osec игнорирует изменения selinux атрибутов
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
listxattr.c
listxattr.c (text/plain), 1.34 KB, created by
Alexey Gladkov
on 2019-10-14 16:47:33 MSK
(
hide
)
Description:
listxattr.c
Filename:
MIME Type:
Creator:
Alexey Gladkov
Created:
2019-10-14 16:47:33 MSK
Size:
1.34 KB
patch
obsolete
>#include <sys/types.h> >#include <sys/xattr.h> > >#include <malloc.h> >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <errno.h> >#include <error.h> > >int >main(int argc, char *argv[]) >{ > ssize_t buflen, keylen, vallen; > char *buf, *key, *val; > > if (argc != 2) { > fprintf(stderr, "Usage: %s path\n", argv[0]); > exit(EXIT_FAILURE); > } > > buflen = listxattr(argv[1], NULL, 0); > if (buflen == -1) > error(EXIT_FAILURE, errno, "listxattr"); > > if (buflen == 0) { > printf("%s has no attributes.\n", argv[1]); > exit(EXIT_SUCCESS); > } > > buf = malloc(buflen); > if (buf == NULL) > error(EXIT_FAILURE, errno, "malloc"); > > buflen = listxattr(argv[1], buf, buflen); > if (buflen == -1) > error(EXIT_FAILURE, errno, "listxattr"); > > key = buf; > while (buflen > 0) { > printf("{%s} = ", key); > > vallen = getxattr(argv[1], key, NULL, 0); > if (vallen == -1) > error(EXIT_SUCCESS, 0, "getxattr"); > > if (vallen > 0) { > val = malloc(vallen + 1); > if (val == NULL) > error(EXIT_FAILURE, errno, "malloc"); > > vallen = getxattr(argv[1], key, val, vallen); > if (vallen == -1) > error(EXIT_SUCCESS, 0, "getxattr"); > else { > val[vallen] = 0; > printf("{%s}", val); > } > > free(val); > } else if (vallen == 0) > printf("<no value>"); > > printf("\n"); > > keylen = strlen(key) + 1; > buflen -= keylen; > key += keylen; > } > > free(buf); > exit(EXIT_SUCCESS); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 37216
: 8336