Make test buildable both using a Makefile and CMake

Fix conditional commands
This commit is contained in:
Ahmed Yarub Hani Al Nuaimi
2021-09-04 22:16:17 -03:00
parent 01c77c34c4
commit eb2fa17582
4 changed files with 13 additions and 5 deletions

View File

@@ -1,3 +1,6 @@
cmake_minimum_required (VERSION 2.6...3.10.2)
project(examples)
set(pkgName "kubernetes")
add_subdirectory(list_pod)

View File

@@ -1,5 +1,5 @@
INCLUDE:=-I../../kubernetes/include -I../../kubernetes/model -I../../kubernetes/api -I../../kubernetes/config
LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
INCLUDE:=-I../../kubernetes/
LIBS:=-L../../kubernetes/build -lyaml -lwebsockets -lkubernetes -L/usr/local/lib
CFLAGS:=-g
BIN:=list_pod_bin

View File

@@ -1,6 +1,5 @@
#include <kube_config.h>
#include <apiClient.h>
#include <CoreV1API.h>
#include <config/kube_config.h>
#include <api/CoreV1API.h>
#include <stdio.h>
void list_pod(apiClient_t * apiClient)

View File

@@ -64,8 +64,14 @@ char *kubeconfig_mk_cert_key_tempfile(const char *data)
return NULL;
}
#ifndef _WIN32
int rc = write(fd, cert_key_data, cert_key_data_bytes);
close(fd);
#else
int rc = _write(fd, cert_key_data, cert_key_data_bytes);
_close(fd);
#endif
if (true == is_data_base64_encoded && cert_key_data) {
free((char *) cert_key_data); // cast "const char *" to "char *"
cert_key_data = NULL;