about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 02745498f9..54cfc6c7fd 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -404,6 +404,15 @@ void printMsg_(Verbosity level, const format & f)
 }
 
 
+void warnOnce(bool & haveWarned, const format & f)
+{
+    if (!haveWarned) {
+        printMsg(lvlError, format("warning: %1%") % f.str());
+        haveWarned = true;
+    }
+}
+
+
 void readFull(int fd, unsigned char * buf, size_t count)
 {
     while (count) {