summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/os_posix/os_snprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/os_posix/os_snprintf.c')
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_snprintf.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/src/os_posix/os_snprintf.c b/src/third_party/wiredtiger/src/os_posix/os_snprintf.c
new file mode 100644
index 00000000000..390e2e0334a
--- /dev/null
+++ b/src/third_party/wiredtiger/src/os_posix/os_snprintf.c
@@ -0,0 +1,27 @@
+/*-
+ * Copyright (c) 2014-2016 MongoDB, Inc.
+ * Copyright (c) 2008-2014 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
+
+#include "wt_internal.h"
+
+/*
+ * __wt_vsnprintf_len_incr --
+ * POSIX vsnprintf convenience function, incrementing the returned size.
+ */
+int
+__wt_vsnprintf_len_incr(
+ char *buf, size_t size, size_t *retsizep, const char *fmt, va_list ap)
+ WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
+{
+ WT_DECL_RET;
+
+ if ((ret = vsnprintf(buf, size, fmt, ap)) >= 0) {
+ *retsizep += (size_t)ret;
+ return (0);
+ }
+ return (__wt_errno());
+}