summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.h b/util.h
index 4fd5962..8fa775d 100644
--- a/util.h
+++ b/util.h
@@ -49,6 +49,19 @@
int xreaddir(DIR *dir, struct dirent **de);
/**
+ * readlinkat() wrapper that dynamically allocates the result.
+ *
+ * @param fd
+ * The base directory descriptor.
+ * @param path
+ * The path to the link, relative to fd.
+ * @param size
+ * An estimate for the size of the link name (pass 0 if unknown).
+ * @return The target of the link, allocated with malloc(), or NULL on failure.
+ */
+char *xreadlinkat(int fd, const char *path, size_t size);
+
+/**
* Check if a file descriptor is open.
*/
bool isopen(int fd);