mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-20 05:00:09 +00:00
3c85f9f1a0
Building with musl libc leads to some build errors: setrans_client.c: In function ‘receive_response’: setrans_client.c:147:19: error: implicit declaration of function ‘readv’ [-Werror=implicit-function-declaration] while (((count = readv(fd, resp_hdr, 3)) < 0) && (errno == EINTR)) ; ^~~~~ and: In file included from matchpathcon.c:10:0: /usr/include/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp] #warning redirecting incorrect #include <sys/errno.h> to <errno.h> ^ Fix the first one by including <sys/uio.h> and the second one by using <errno.h> instead of <sys/errno.h>. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
36 lines
660 B
C
36 lines
660 B
C
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <getopt.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <selinux/selinux.h>
|
|
|
|
static __attribute__ ((__noreturn__)) void usage(const char *progname)
|
|
{
|
|
fprintf(stderr, "usage: %s tty_context...\n", progname);
|
|
exit(1);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int i;
|
|
if (argc < 2)
|
|
usage(argv[0]);
|
|
|
|
for (i = 1; i < argc; i++) {
|
|
switch (selinux_check_securetty_context(argv[i])) {
|
|
case 0:
|
|
printf("%s securetty.\n", argv[i]);
|
|
break;
|
|
default:
|
|
printf("%s not securetty.\n", argv[i]);
|
|
break;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|