summaryrefslogtreecommitdiff
path: root/Tests/Kernel/TestInvalidUIDSet.cpp
blob: 19ba9d5585f175f45c95593b4af4f3574d7c4191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibTest/TestCase.h>
#include <errno.h>
#include <unistd.h>

TEST_CASE(test_invalid_set_uid_parameters)
{
    auto res = setuid(-1);
    EXPECT_EQ(res, -1);
    EXPECT_EQ(errno, EINVAL);

    res = seteuid(-1);
    EXPECT_EQ(res, -1);
    EXPECT_EQ(errno, EINVAL);

    res = setgid(-1);
    EXPECT_EQ(res, -1);
    EXPECT_EQ(errno, EINVAL);

    res = setegid(-1);
    EXPECT_EQ(res, -1);
    EXPECT_EQ(errno, EINVAL);
}