summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorReverend Homer <mk.43.ecko@gmail.com>2016-12-09 12:04:30 +0300
committerMartin Pitt <martin.pitt@ubuntu.com>2016-12-09 10:04:30 +0100
commit8fb3f0099787a5b48213c4e2aa42d8ff61b0c7f1 (patch)
treec9bf990e18daac08ec1e744d6be365a9e98d2532 /src/core/manager.c
parent9258a1cae3985ee590f1c698451bd7909aa38d2b (diff)
tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853)
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 1f663d3c1d..21cd6062c6 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -17,7 +17,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/kd.h>
@@ -233,6 +232,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
static int have_ask_password(void) {
_cleanup_closedir_ DIR *dir;
+ struct dirent *de;
dir = opendir("/run/systemd/ask-password");
if (!dir) {
@@ -242,19 +242,11 @@ static int have_ask_password(void) {
return -errno;
}
- for (;;) {
- struct dirent *de;
-
- errno = 0;
- de = readdir(dir);
- if (!de && errno > 0)
- return -errno;
- if (!de)
- return false;
-
+ FOREACH_DIRENT_ALL(de, dir, return -errno) {
if (startswith(de->d_name, "ask."))
return true;
}
+ return false;
}
static int manager_dispatch_ask_password_fd(sd_event_source *source,