diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-10-30 18:28:01 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-10-30 18:28:01 +0100 |
commit | 47f0f4eb1d79ec37dfbe6a382817c0384b106373 (patch) | |
tree | d6c73cf6043ded167941e8cab4e30bc0c97cae61 /src/shared/memfd.c | |
parent | f6721176284fe49b1beb146c70379cd1f2b17852 (diff) |
memfd: drop memfd_get_name() as it is unused
Diffstat (limited to 'src/shared/memfd.c')
-rw-r--r-- | src/shared/memfd.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/shared/memfd.c b/src/shared/memfd.c index f3ce8f84da..b558177951 100644 --- a/src/shared/memfd.c +++ b/src/shared/memfd.c @@ -172,50 +172,3 @@ int memfd_new_and_map(const char *name, size_t sz, void **p) { return r; } - -int memfd_get_name(int fd, char **name) { - char path[sizeof("/proc/self/fd/") + DECIMAL_STR_MAX(int)], buf[FILENAME_MAX+1], *e; - const char *delim, *end; - _cleanup_free_ char *n = NULL; - ssize_t k; - - assert(fd >= 0); - assert(name); - - sprintf(path, "/proc/self/fd/%i", fd); - - k = readlink(path, buf, sizeof(buf)); - if (k < 0) - return -errno; - - if ((size_t) k >= sizeof(buf)) - return -E2BIG; - - buf[k] = 0; - - delim = strstr(buf, ":["); - if (!delim) - return -EIO; - - delim = strchr(delim + 2, ':'); - if (!delim) - return -EIO; - - delim++; - - end = strchr(delim, ']'); - if (!end) - return -EIO; - - n = strndup(delim, end - delim); - if (!n) - return -ENOMEM; - - e = utf8_escape_invalid(n); - if (!e) - return -ENOMEM; - - *name = e; - - return 0; -} |