projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e8308aa
)
Don't call strlen(nullptr) in mkdtemp and mkstemp
author
Christopher Dykes
<cdykes@fb.com>
Fri, 12 Aug 2016 21:29:28 +0000
(14:29 -0700)
committer
Facebook Github Bot
<facebook-github-bot-bot@fb.com>
Fri, 12 Aug 2016 21:38:27 +0000
(14:38 -0700)
Summary: Because it's a terrible idea. It also didn't work.
Reviewed By: yfeldblum
Differential Revision:
D3711443
fbshipit-source-id:
48ab77dfff005347c72daeaf0d27390bb86f4bd1
folly/portability/Stdlib.cpp
patch
|
blob
|
history
diff --git
a/folly/portability/Stdlib.cpp
b/folly/portability/Stdlib.cpp
index 049443a25dc13a1945d45fd110e1188df26c61f3..85cbe0b042523264be8fb57fc038fdae0e50f30c 100644
(file)
--- a/
folly/portability/Stdlib.cpp
+++ b/
folly/portability/Stdlib.cpp
@@
-19,6
+19,7
@@
#ifdef _WIN32
#include <cstring>
#include <errno.h>
+
#include <folly/portability/Fcntl.h>
#include <folly/portability/SysStat.h>
#include <folly/portability/Windows.h>
@@
-31,7
+32,7
@@
char* mktemp(char* tn) { return _mktemp(tn); }
// still working just fine.
char* mkdtemp(char* tn) {
char* ptr = nullptr;
- auto len = strlen(
ptr
);
+ auto len = strlen(
tn
);
int ret = 0;
do {
strcpy(tn + len - 6, "XXXXXX");
@@
-49,7
+50,7
@@
char* mkdtemp(char* tn) {
int mkstemp(char* tn) {
char* ptr = nullptr;
- auto len = strlen(
ptr
);
+ auto len = strlen(
tn
);
int ret = 0;
do {
strcpy(tn + len - 6, "XXXXXX");