Revert change

This commit is contained in:
Ahmed Yarub Hani Al Nuaimi
2021-09-09 09:51:52 -03:00
parent 5e2613354b
commit d0390e2b08

View File

@@ -44,11 +44,9 @@ char *kubeconfig_mk_cert_key_tempfile(const char *data)
cert_key_data_bytes = strlen(cert_key_data); cert_key_data_bytes = strlen(cert_key_data);
} }
int fd;
#ifndef _WIN32 #ifndef _WIN32
char tempfile_name_template[] = KUBE_CONFIG_TEMPFILE_NAME_TEMPLATE; char tempfile_name_template[] = KUBE_CONFIG_TEMPFILE_NAME_TEMPLATE;
fd = mkstemp(tempfile_name_template); int fd = mkstemp(tempfile_name_template);
#else #else
char *tempdir_env = getenv("TEMP"); char *tempdir_env = getenv("TEMP");
int tmpFileNameSize = strlen(tempdir_env) + strlen(KUBE_CONFIG_TEMPFILE_NAME_TEMPLATE) + 1; int tmpFileNameSize = strlen(tempdir_env) + strlen(KUBE_CONFIG_TEMPFILE_NAME_TEMPLATE) + 1;
@@ -56,7 +54,7 @@ char *kubeconfig_mk_cert_key_tempfile(const char *data)
snprintf(tempfile_name_template, tmpFileNameSize, KUBE_CONFIG_TEMPFILE_NAME_TEMPLATE, tempdir_env); snprintf(tempfile_name_template, tmpFileNameSize, KUBE_CONFIG_TEMPFILE_NAME_TEMPLATE, tempdir_env);
char *filename = _mktemp(tempfile_name_template); char *filename = _mktemp(tempfile_name_template);
free(tempfile_name_template); free(tempfile_name_template);
fd = _sopen( filename, O_CREAT|O_WRONLY, _SH_DENYWR ); int fd = _sopen( filename, O_CREAT|O_WRONLY, _SH_DENYWR );
#endif #endif
if (-1 == fd) { if (-1 == fd) {