diff options
author | Luca Boccassi <bluca@debian.org> | 2024-04-26 18:09:04 +0200 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2024-04-26 18:20:04 +0200 |
commit | e86e9ebf60a41cb698c445ac78ad5cafe7086d3a (patch) | |
tree | aea2e068b2018b77c056257b300782f68562c0ee /src/test | |
parent | test: do not fail if mknod() fails in a build system (diff) | |
download | systemd-e86e9ebf60a41cb698c445ac78ad5cafe7086d3a.tar.xz systemd-e86e9ebf60a41cb698c445ac78ad5cafe7086d3a.zip |
test: modernize test-dirent-util
Follow-up for 6a57d86bf9d7f8d6f5d339f57665dfb2e1d191c5
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-dirent-util.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/test/test-dirent-util.c b/src/test/test-dirent-util.c index 5d4886241d..420ccd108d 100644 --- a/src/test/test-dirent-util.c +++ b/src/test/test-dirent-util.c @@ -74,28 +74,28 @@ TEST (test_dirent_is_file) { } rewinddir(dir); - while ((de_reg = readdir_ensure_type(dir)) != NULL) - if (strcmp(de_reg->d_name, "test.txt") == 0) + while ((de_reg = readdir_ensure_type(dir))) + if (streq(de_reg->d_name, "test.txt")) break; rewinddir(dir); - while ((de_lnk = readdir_ensure_type(dir)) != NULL) - if (strcmp(de_lnk->d_name, "test_link") == 0) + while ((de_lnk = readdir_ensure_type(dir))) + if (streq(de_lnk->d_name, "test_link")) break; rewinddir(dir); - while ((de_dot = readdir_ensure_type(dir)) != NULL) - if (strcmp(de_dot->d_name, ".hidden_file") == 0) + while ((de_dot = readdir_ensure_type(dir))) + if (streq(de_dot->d_name, ".hidden_file")) break; rewinddir(dir); - while ((de_bak = readdir(dir)) != NULL) - if (strcmp(de_bak->d_name, "test.bak") == 0) + while ((de_bak = readdir(dir))) + if (streq(de_bak->d_name, "test.bak")) break; rewinddir(dir); - while ((de_tilda = readdir(dir)) != NULL) - if (strcmp(de_tilda->d_name, "test~") == 0) + while ((de_tilda = readdir(dir))) + if (streq(de_tilda->d_name, "test~")) break; /* Test when d_type is DT_REG, DT_LNK, or DT_UNKNOWN */ @@ -154,29 +154,29 @@ TEST (test_dirent_is_file_with_suffix) { } rewinddir(dir); - while ((de_reg = readdir_ensure_type(dir)) != NULL) - if (strcmp(de_reg->d_name, "test.txt") == 0) + while ((de_reg = readdir_ensure_type(dir))) + if (streq(de_reg->d_name, "test.txt")) break; rewinddir(dir); - while ((de_lnk = readdir_ensure_type(dir)) != NULL) - if (strcmp(de_lnk->d_name, "test_link") == 0) + while ((de_lnk = readdir_ensure_type(dir))) + if (streq(de_lnk->d_name, "test_link")) break; rewinddir(dir); - while ((de_dot = readdir_ensure_type(dir)) != NULL) - if (strcmp(de_dot->d_name, ".hidden_file") == 0) + while ((de_dot = readdir_ensure_type(dir))) + if (streq(de_dot->d_name, ".hidden_file")) break; rewinddir(dir); - while ((de_dotdot = readdir(dir)) != NULL) - if (strcmp(de_dotdot->d_name, "..dotdot") == 0) + while ((de_dotdot = readdir(dir))) + if (streq(de_dotdot->d_name, "..dotdot")) break; if (chr) { rewinddir(dir); - while ((de_chr = readdir(dir)) != NULL) - if (strcmp(de_chr->d_name, "test_chr") == 0) + while ((de_chr = readdir(dir))) + if (streq(de_chr->d_name, "test_chr")) break; /* Test when d_type is not DT_REG, DT_LNK, or DT_UNKNOWN */ |