aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index c44164b..25c1a71 100644
--- a/src/util.h
+++ b/src/util.h
@@ -40,3 +40,15 @@ void* memdup(const void* src, size_t n);
*/
void* nread(int fd, size_t* n);
+
+/**
+ * Duplicate a file descriptor an make sure
+ * the new file descriptor's index as a
+ * specified minimum value
+ *
+ * @param fd The file descriptor
+ * @param atleast The least acceptable new file descriptor
+ * @return The new file descriptor, -1 on error
+ */
+int dup2atleast(int fd, int atleast);
+