diff options
author | Tom Gundersen <teg@jklm.no> | 2013-07-16 23:05:02 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2013-07-17 01:36:03 +0200 |
commit | db0c1e3bd39c9151ba4ac8e029ec77a4ec923bd1 (patch) | |
tree | fd323684d799a7763887c33a7b79ec6eec6ade0a /src/login | |
parent | 6b78df0a6ec75f25705a0f78ef895b95ab75a7ea (diff) |
logind-acl: use macros
Simplify by using FOREACH_DIRENT and _cleanup_closedir_ macros.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/logind-acl.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c index c0ff509377..390b4b2885 100644 --- a/src/login/logind-acl.c +++ b/src/login/logind-acl.c @@ -183,7 +183,7 @@ int devnode_acl_all(struct udev *udev, Set *nodes; Iterator i; char *n; - DIR *dir; + _cleanup_closedir_ DIR *dir = NULL; struct dirent *dent; int r; @@ -258,35 +258,28 @@ int devnode_acl_all(struct udev *udev, * these devices are not known to the kernel at this moment */ dir = opendir("/run/udev/static_node-tags/uaccess"); if (dir) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + FOREACH_DIRENT(dent, dir, r = -errno; goto finish) { _cleanup_free_ char *unescaped_devname = NULL; - if (dent->d_name[0] == '.') - continue; - unescaped_devname = cunescape(dent->d_name); if (unescaped_devname == NULL) { r = -ENOMEM; - closedir(dir); goto finish; } n = strappend("/dev/", unescaped_devname); if (!n) { r = -ENOMEM; - closedir(dir); goto finish; } log_debug("Found static node %s for seat %s", n, seat); r = set_put(nodes, n); if (0 && r < 0 && r != -EEXIST) { - closedir(dir); goto finish; } else r = 0; } - closedir(dir); } SET_FOREACH(n, nodes, i) { |