diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-04-06 23:11:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 23:11:56 +0900 |
commit | 2eeabd448929c1a11fa45d255306dbfcc0c07076 (patch) | |
tree | 7c102798c9b51b0e9c3d5b1c2128a9c23b4d8470 | |
parent | a9e832092a36b1ecd6cc4e10abd2160cf0210954 (diff) | |
parent | e992fd18a813cdf7f54761e383c3f86a725ad3c5 (diff) | |
download | systemd-2eeabd448929c1a11fa45d255306dbfcc0c07076.tar.gz |
Merge pull request #22983 from yuwata/login-use-symlinks-under-static_node-tags
login: shorten code a bit
-rw-r--r-- | src/shared/devnode-acl.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/shared/devnode-acl.c b/src/shared/devnode-acl.c index d2b78f392a..357efc1930 100644 --- a/src/shared/devnode-acl.c +++ b/src/shared/devnode-acl.c @@ -9,9 +9,9 @@ #include "device-util.h" #include "devnode-acl.h" #include "dirent-util.h" -#include "escape.h" #include "fd-util.h" #include "format-util.h" +#include "fs-util.h" #include "set.h" #include "string-util.h" #include "util.h" @@ -195,21 +195,18 @@ int devnode_acl_all(const char *seat, dir = opendir("/run/udev/static_node-tags/uaccess"); if (dir) { FOREACH_DIRENT(de, dir, return -errno) { - _cleanup_free_ char *unescaped_devname = NULL; - ssize_t l; - - l = cunescape(de->d_name, UNESCAPE_RELAX, &unescaped_devname); - if (l < 0) - return l; - - n = path_join("/dev", unescaped_devname); - if (!n) - return -ENOMEM; + r = readlinkat_malloc(dirfd(dir), de->d_name, &n); + if (r == -ENOENT) + continue; + if (r < 0) { + log_debug_errno(r, + "Unable to read symlink '/run/udev/static_node-tags/uaccess/%s', ignoring: %m", + de->d_name); + continue; + } log_debug("Found static node %s for seat %s", n, seat); r = set_consume(nodes, n); - if (r == -EEXIST) - continue; if (r < 0) return r; } |