Skip to content

Commit 59bb1a5

Browse files
committed
Fix error in compiling without SELinux
Fixes: #131 Signed-off-by: Simo Sorce <[email protected]> Reviewed-by: Nathaniel McCallum <[email protected]> Reviewed-by: Roland Mainz <[email protected]>
1 parent aa4fc60 commit 59bb1a5

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

proxy/src/gp_selinux.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,22 @@
4848
#define SELINUX_CTX void *
4949
#define SEC_CTX void *
5050

51-
void *SELINUX_context_new(const char *str) { return NULL; }
52-
#define SELINUX_context_free(x) (x) = NULL;
53-
const char *SELINUX_context_dummy_get(void *) { return NULL; }
51+
#define SELINUX_context_new(x) NULL
52+
#define SELINUX_context_free(x) (x) = NULL
53+
#define SELINUX_context_dummy_get(x) "<SELinux not compiled in>"
5454
#define SELINUX_context_str SELINUX_context_dummy_get
5555
#define SELINUX_context_type_get SELINUX_context_dummy_get
5656
#define SELINUX_context_user_get SELINUX_context_dummy_get
5757
#define SELINUX_context_role_get SELINUX_context_dummy_get
5858
#define SELINUX_context_range_get SELINUX_context_dummy_get
5959

6060
#include <errno.h>
61-
int SELINUX_getpeercon(int fd, SEC_CTX *con)
62-
{
63-
*con = NULL;
64-
errno = ENOTSUP;
65-
return -1;
66-
}
67-
#define SELINUX_freecon(x) (x) = NULL;
61+
#define SELINUX_getpeercon(x, y) -1; do { \
62+
*(y) = NULL; \
63+
errno = ENOTSUP; \
64+
} while(0)
65+
66+
#define SELINUX_freecon(x) (x) = NULL
6867

6968
#endif /* done HAVE_SELINUX */
7069

0 commit comments

Comments
 (0)