From b39a4a3aba7e8593684b6e44b0780c2439e84d7d Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 11 Feb 2015 16:21:18 -0500 Subject: udev: event - move renaming of udev_device to libudev This is not exposed in the public API. We want to simplify the internal libudev-device API as much as possible so that it will be simpler to rip the whole thing out in the future. Signed-off-by: Anthony G. Basile --- src/shared/util.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/shared/util.c') diff --git a/src/shared/util.c b/src/shared/util.c index e76325e7c2..091b3c04a1 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -846,6 +846,24 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) { return n; } +char* dirname_malloc(const char *path) { + char *d, *dir, *dir2; + + d = strdup(path); + if (!d) + return NULL; + dir = dirname(d); + assert(dir); + + if (dir != d) { + dir2 = strdup(dir); + free(d); + return dir2; + } + + return dir; +} + int dev_urandom(void *p, size_t n) { static int have_syscall = -1; int r, fd; -- cgit v1.2.3-54-g00ecf