Use non-deprecated methods on windows.
Use of strdup, close, lseek, read, and write prevent linking
statically againt libcmt.lib.
Change-Id: I04f7876ec0f03f29f000bbcc6b2ccdec844452d2
Reviewed-on: https://boringssl-review.googlesource.com/8010
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/tool/pkcs12.cc b/tool/pkcs12.cc
index fe830d6..15e32d3 100644
--- a/tool/pkcs12.cc
+++ b/tool/pkcs12.cc
@@ -64,7 +64,7 @@
return false;
}
- int fd = open(args_map["-dump"].c_str(), O_RDONLY);
+ int fd = BORINGSSL_OPEN(args_map["-dump"].c_str(), O_RDONLY);
if (fd < 0) {
perror("open");
return false;
@@ -73,7 +73,7 @@
struct stat st;
if (fstat(fd, &st)) {
perror("fstat");
- close(fd);
+ BORINGSSL_CLOSE(fd);
return false;
}
const size_t size = st.st_size;
@@ -82,7 +82,7 @@
read_result_t n;
size_t off = 0;
do {
- n = read(fd, &contents[off], size - off);
+ n = BORINGSSL_READ(fd, &contents[off], size - off);
if (n >= 0) {
off += static_cast<size_t>(n);
}
@@ -90,11 +90,11 @@
if (off != size) {
perror("read");
- close(fd);
+ BORINGSSL_CLOSE(fd);
return false;
}
- close(fd);
+ BORINGSSL_CLOSE(fd);
printf("Enter password: ");
fflush(stdout);
@@ -102,7 +102,7 @@
char password[256];
off = 0;
do {
- n = read(0, &password[off], sizeof(password) - 1 - off);
+ n = BORINGSSL_READ(0, &password[off], sizeof(password) - 1 - off);
if (n >= 0) {
off += static_cast<size_t>(n);
}