Skip to content

Commit

Permalink
fix for review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-hx authored and Harry Xi committed Feb 7, 2024
1 parent 0372555 commit 5313732
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cpp/FileTransferAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ RemoteStorageRequestOutcome Snowflake::Client::FileTransferAgent::downloadSingle
FileMetadata *fileMetadata,
size_t resultIndex)
{
char strerr_buf[SF_ERROR_BUFSIZE];

fileMetadata->destPath = std::string(response.localLocation) + PATH_SEP +
fileMetadata->destFileName;
std::string destPathPlatform = m_stmtPutGet->UTF8ToPlatformString(fileMetadata->destPath);
Expand All @@ -847,7 +849,6 @@ RemoteStorageRequestOutcome Snowflake::Client::FileTransferAgent::downloadSingle
}
catch (...) {
std::string err = "Could not open file " + fileMetadata->destPath + " to downoad";
char strerr_buf[1024];
char* str_error = sf_strerror(errno, strerr_buf, sizeof(strerr_buf));
CXX_LOG_DEBUG("Could not open file %s to downoad: %s",
fileMetadata->destPath.c_str(), str_error);
Expand All @@ -857,7 +858,6 @@ RemoteStorageRequestOutcome Snowflake::Client::FileTransferAgent::downloadSingle
if (!dstFile.is_open())
{
std::string err = "Could not open file " + fileMetadata->destPath + " to downoad";
char strerr_buf[1024];
char* str_error = sf_strerror(errno, strerr_buf, sizeof(strerr_buf));
CXX_LOG_DEBUG("Could not open file %s to downoad: %s",
fileMetadata->destPath.c_str(), str_error);
Expand Down
2 changes: 1 addition & 1 deletion cpp/util/ThreadPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class ThreadPool {
int err = pthread_key_create(&key, NULL);
if (err)
{
char strerrbuf[1024];
char strerrbuf[SF_ERROR_BUFSIZE];
CXX_LOG_ERROR("Thread pool creating key failed with error: %s", sf_strerror(err, strerrbuf, sizeof(strerrbuf)));
throw SnowflakeTransferException(TransferError::INTERNAL_ERROR,
"Thread context fail to initialize");
Expand Down
1 change: 1 addition & 0 deletions include/snowflake/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ int STDCALL sf_unsetenv(const char *name);

int STDCALL sf_mkdir(const char *path);

#define SF_ERROR_BUFSIZE 1024
char* STDCALL sf_strerror(int errnum, char* outbuf, size_t bufsize);

int STDCALL
Expand Down
2 changes: 1 addition & 1 deletion lib/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ static sf_bool STDCALL log_init(const char *log_path, SF_LOG_LEVEL log_level) {
const char *sf_log_level_str;
char log_level_buf[64];
SF_LOG_LEVEL sf_log_level = log_level;
char strerror_buf[1024];
char strerror_buf[SF_ERROR_BUFSIZE];

size_t log_path_size = 1; //Start with 1 to include null terminator
log_path_size += strlen(time_str);
Expand Down
2 changes: 1 addition & 1 deletion lib/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ log_log_va_list(int level, const char *file, int line, const char *ns,
return;
}

char strerr_buf[1024];
char strerr_buf[SF_ERROR_BUFSIZE];
char tsbuf[50]; /* timestamp buffer*/
sf_log_timestamp(tsbuf, sizeof(tsbuf));

Expand Down
2 changes: 1 addition & 1 deletion tests/test_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void test_connect_with_ocsp_cache_server_on(void **unused) {
* in parameter are being used.
*/
void test_connect_with_proxy(void **unused) {
SKIP_IF_PROXY_ENV_IS_SET
SKIP_IF_PROXY_ENV_IS_SET;

// set invalid proxy in environment variables
sf_setenv("https_proxy", "a.b.c");
Expand Down
8 changes: 4 additions & 4 deletions tests/test_simple_put.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ void test_2GBlarge_get(void **unused)

void test_simple_put_with_proxy(void **unused)
{
SKIP_IF_PROXY_ENV_IS_SET
SKIP_IF_PROXY_ENV_IS_SET;

// set invalid proxy in environment variables
sf_setenv("https_proxy", "a.b.c");
Expand Down Expand Up @@ -1302,7 +1302,7 @@ void test_simple_put_with_proxy(void **unused)

void test_simple_put_with_noproxy(void **unused)
{
SKIP_IF_PROXY_ENV_IS_SET
SKIP_IF_PROXY_ENV_IS_SET;

// set invalid proxy in environment variables
sf_setenv("https_proxy", "a.b.c");
Expand Down Expand Up @@ -1343,7 +1343,7 @@ void test_simple_put_with_noproxy(void **unused)

void test_simple_put_with_proxy_fromenv(void **unused)
{
SKIP_IF_PROXY_ENV_IS_SET
SKIP_IF_PROXY_ENV_IS_SET;

// set invalid proxy settings
sf_setenv("https_proxy", "a.b.c");
Expand Down Expand Up @@ -1390,7 +1390,7 @@ void test_simple_put_with_proxy_fromenv(void **unused)

void test_simple_put_with_noproxy_fromenv(void **unused)
{
SKIP_IF_PROXY_ENV_IS_SET
SKIP_IF_PROXY_ENV_IS_SET;

// set invalid proxy settings
sf_setenv("https_proxy", "a.b.c");
Expand Down

0 comments on commit 5313732

Please sign in to comment.