diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-01-09 16:25:47 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-01-09 18:35:36 +0100 |
commit | 8cb4ab0058e51f1fba93683d145ef95f97c2fa86 (patch) | |
tree | 022bbd937efd224d8de1e2c5db66331a6149ed74 /src/test/test-util.c | |
parent | 309a29dfd24f4175de334ca1593e3fe2436ab082 (diff) |
logind: unify how we cast between uid_t and pointers for hashmap keys
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r-- | src/test/test-util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index 3c79f8f4d9..d529a213cc 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -1415,6 +1415,15 @@ static void test_same_fd(void) { assert_se(same_fd(b, a) == 0); } +static void test_uid_ptr(void) { + + assert_se(UID_TO_PTR(0) != NULL); + assert_se(UID_TO_PTR(1000) != NULL); + + assert_se(PTR_TO_UID(UID_TO_PTR(0)) == 0); + assert_se(PTR_TO_UID(UID_TO_PTR(1000)) == 1000); +} + int main(int argc, char *argv[]) { log_parse_environment(); log_open(); @@ -1490,6 +1499,7 @@ int main(int argc, char *argv[]) { test_parse_proc_cmdline(); test_raw_clone(); test_same_fd(); + test_uid_ptr(); return 0; } |