diff options
author | Tom Gundersen <teg@jklm.no> | 2015-02-11 16:21:18 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-02-11 16:21:58 -0500 |
commit | b39a4a3aba7e8593684b6e44b0780c2439e84d7d (patch) | |
tree | e4cdb633a310bae4689a4f44b306e778b974b628 /src/shared/util.c | |
parent | 691df3c5c399899a9fd6624f6148883cc20fa18a (diff) |
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 <blueness@gentoo.org>
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 18 |
1 files changed, 18 insertions, 0 deletions
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; |