summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2016-02-03 14:07:49 +1100
committerDavid Hows <howsdav@gmail.com>2016-02-03 14:07:49 +1100
commit50d25923dea9e413243dbcae2b976673bf15e459 (patch)
tree7bd43ca8ea18f5e6299fc8b157cc4f3876fb4b79
parent9f10e410fc8ecd0c9a610eb726c17b2d0e28a097 (diff)
downloadmongo-50d25923dea9e413243dbcae2b976673bf15e459.tar.gz
WT-2377 - change wtperfs dstrndup to not call strndup as it is not supported on MSVC
-rw-r--r--bench/wtperf/wtperf.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h
index 120b93262b4..ea8c5395751 100644
--- a/bench/wtperf/wtperf.h
+++ b/bench/wtperf/wtperf.h
@@ -88,7 +88,7 @@ typedef struct {
int64_t insert; /* Insert ratio */
int64_t read; /* Read ratio */
int64_t update; /* Update ratio */
- uint64_t throttle; /* Maximum operations/second */
+ uint64_t throttle; /* Maximum operations/second */
/* Number of operations per transaction. Zero for autocommit */
int64_t ops_per_txn;
int64_t truncate; /* Truncate ratio */
@@ -409,10 +409,11 @@ static inline char *
dstrndup(const char *str, const size_t len)
{
char *p;
+ p = dcalloc(len + 1, 1);
- if ((p = strndup(str, len)) == NULL)
- die(errno, "strndup");
+ strncpy(p, str, len);
+ if (p == NULL)
+ die(errno, "dstrndup");
return (p);
}
-
#endif