Skip to content

Commit 9d6452d

Browse files
committed
out_gcs: Fix Windows build
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent b2635b7 commit 9d6452d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

plugins/out_gcs/gcs.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ static int gcs_under_test_mode(void)
7474
return FLB_FALSE;
7575
}
7676

77+
static int gcs_setenv(const char *key, const char *val)
78+
{
79+
#ifdef FLB_SYSTEM_WINDOWS
80+
return _putenv_s(key, val);
81+
#else
82+
return setenv(key, val, 1);
83+
#endif
84+
}
7785

7886
static void mock_gcs_call_increment_counter(const char *api)
7987
{
@@ -87,7 +95,7 @@ static void mock_gcs_call_increment_counter(const char *api)
8795
count = val ? atoi(val) : 0;
8896
count++;
8997
snprintf(buf, sizeof(buf), "%d", count);
90-
setenv(env_var, buf, 1);
98+
gcs_setenv(env_var, buf);
9199
}
92100

93101
static int read_seq_index(const char *path, uint64_t *out_value)

0 commit comments

Comments
 (0)