Skip to content
Snippets Groups Projects
Commit 7e0541bb authored by Constantin Papizh's avatar Constantin Papizh
Browse files

Pipeline for macos fixed

parent 175144c9
No related branches found
No related tags found
4 merge requests!251Master,!250Master,!190Feature 4453,!184Pipeline for macos fixed
Pipeline #5029 passed with stage
in 20 seconds
...@@ -392,8 +392,7 @@ int timespec_diff(struct timespec *a_start, struct timespec *a_stop, struct time ...@@ -392,8 +392,7 @@ int timespec_diff(struct timespec *a_start, struct timespec *a_stop, struct time
int get_select_breaker(void); int get_select_breaker(void);
int send_select_break(void); int send_select_break(void);
char * exec_with_ret(const char * a_cmd); int exec_with_ret(char**, const char*);
char * exec_with_ret_multistring(const char * a_cmd);
char * dap_random_string_create_alloc(size_t a_length); char * dap_random_string_create_alloc(size_t a_length);
void dap_random_string_fill(char *str, size_t length); void dap_random_string_fill(char *str, size_t length);
void dap_dump_hex(const void* data, size_t size); void dap_dump_hex(const void* data, size_t size);
......
...@@ -519,6 +519,27 @@ int send_select_break( ) ...@@ -519,6 +519,27 @@ int send_select_break( )
return 0; return 0;
} }
int exec_with_ret(char** repl, const char * a_cmd) {
FILE * fp;
size_t buf_len = 0;
char buf[4096] = {0};
fp = popen(a_cmd, "r");
if (!fp) {
log_it(L_ERROR,"Cmd execution error: '%s'", strerror(errno));
return(255);
}
memset(buf, 0, sizeof(buf));
fgets(buf, sizeof(buf) - 1, fp);
buf_len = strlen(buf);
if(repl) {
if(buf[buf_len - 1] == '\n')
buf[buf_len - 1] ='\0';
*repl = strdup(buf);
}
return pclose(fp);
}
#ifdef ANDROID1 #ifdef ANDROID1
static u_long myNextRandom = 1; static u_long myNextRandom = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment