From 47f0f4eb1d79ec37dfbe6a382817c0384b106373 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 30 Oct 2014 18:28:01 +0100 Subject: memfd: drop memfd_get_name() as it is unused --- src/shared/memfd.c | 47 ----------------------------------------------- src/shared/memfd.h | 2 -- 2 files changed, 49 deletions(-) (limited to 'src') 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; -} diff --git a/src/shared/memfd.h b/src/shared/memfd.h index 8f02b0ff55..cf588fe02f 100644 --- a/src/shared/memfd.h +++ b/src/shared/memfd.h @@ -38,5 +38,3 @@ int memfd_get_sealed(int fd); int memfd_get_size(int fd, uint64_t *sz); int memfd_set_size(int fd, uint64_t sz); - -int memfd_get_name(int fd, char **name); -- cgit v1.2.3-54-g00ecf