mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-06 13:17:44 +03:00
parent
95f7ab2fe6
commit
e742ec6abc
@ -6,13 +6,15 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "acl-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-util.h"
|
||||
#include "string-util.h"
|
||||
#include "tests.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
|
||||
static void test_add_acls_for_user(void) {
|
||||
static int test_add_acls_for_user(void) {
|
||||
char fn[] = "/tmp/test-empty.XXXXXX";
|
||||
_cleanup_close_ int fd = -1;
|
||||
char *cmd;
|
||||
@ -42,6 +44,9 @@ static void test_add_acls_for_user(void) {
|
||||
uid = getuid();
|
||||
|
||||
r = fd_add_uid_acl_permission(fd, uid, ACL_READ);
|
||||
if (ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return log_tests_skipped("no ACL support on /tmp");
|
||||
|
||||
log_info_errno(r, "fd_add_uid_acl_permission(%i, "UID_FMT", ACL_READ): %m", fd, uid);
|
||||
assert_se(r >= 0);
|
||||
|
||||
@ -62,11 +67,10 @@ static void test_add_acls_for_user(void) {
|
||||
cmd = strjoina("getfacl -p ", fn);
|
||||
assert_se(system(cmd) == 0);
|
||||
|
||||
unlink(fn);
|
||||
(void) unlink(fn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
test_add_acls_for_user();
|
||||
|
||||
return 0;
|
||||
return test_add_acls_for_user();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user