R-fs/0002-Initialize-stat-buf-to...

28 lines
854 B
Diff

From 69d07f43f13c7fa50d87e9d0c38cec23860dd5eb Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sun, 5 May 2019 14:21:57 -0400
Subject: [PATCH 2/2] Initialize stat buf to be zero.
This works around https://github.com/libuv/libuv/issues/2262.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
src/file.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/file.cc b/src/file.cc
index ed017e8f..184094fa 100644
--- a/src/file.cc
+++ b/src/file.cc
@@ -148,6 +148,7 @@ List stat_(CharacterVector path, bool fail) {
for (i = 0; i < Rf_xlength(path); ++i) {
uv_fs_t req;
const char* p = CHAR(STRING_ELT(path, i));
+ memset(&req, 0, sizeof(req));
int res = uv_fs_lstat(uv_default_loop(), &req, p, NULL);
bool is_na = STRING_ELT(path, i) == NA_STRING;
--
2.20.1