diff options
author | Florian Weimer <fweimer@redhat.com> | 2013-12-19 11:59:19 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-21 18:35:55 -0500 |
commit | 4d993c8cb75aef0f4293e0b9e8f249dd0530b5d8 (patch) | |
tree | 2b97a76bf46ebf5e487838a26c37644b9dc81fa7 /src/shared/install.c | |
parent | 9fa3006323e86962ceaa3171b906cf2b1c2cf525 (diff) |
install: replace readdir_r with readdir
The old code incorrectly assumed that readdir_r updates errno.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r-- | src/shared/install.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index 17e8a7508e..5001ad43be 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -212,11 +212,10 @@ static int remove_marked_symlinks_fd( for (;;) { struct dirent *de; - union dirent_storage buf; - int k; - k = readdir_r(d, &buf.de, &de); - if (k != 0) { + errno = 0; + de = readdir(d); + if (!de && errno != 0) { r = -errno; break; } @@ -373,12 +372,11 @@ static int find_symlinks_fd( } for (;;) { - int k; struct dirent *de; - union dirent_storage buf; - k = readdir_r(d, &buf.de, &de); - if (k != 0) + errno = 0; + de = readdir(d); + if (!de && errno != 0) return -errno; if (!de) @@ -1938,12 +1936,12 @@ int unit_file_get_list( for (;;) { struct dirent *de; - union dirent_storage buffer; _cleanup_unitfilelist_free_ UnitFileList *f = NULL; - r = readdir_r(d, &buffer.de, &de); - if (r != 0) - return -r; + errno = 0; + de = readdir(d); + if (!de && errno != 0) + return -errno; if (!de) break; |