Skip to content
Snippets Groups Projects
Commit 40e142e2 authored by Alexandr Mruchok's avatar Alexandr Mruchok
Browse files

Merge branch 'pipeline-fix' into 'master'

Pipeline for macos fixed

See merge request !184
parents 175144c9 7e0541bb
No related branches found
No related tags found
4 merge requests!251Master,!250Master,!190Feature 4453,!184Pipeline for macos fixed
Pipeline #5035 passed with stage
in 33 seconds
......@@ -392,8 +392,7 @@ int timespec_diff(struct timespec *a_start, struct timespec *a_stop, struct time
int get_select_breaker(void);
int send_select_break(void);
char * exec_with_ret(const char * a_cmd);
char * exec_with_ret_multistring(const char * a_cmd);
int exec_with_ret(char**, const char*);
char * dap_random_string_create_alloc(size_t a_length);
void dap_random_string_fill(char *str, size_t length);
void dap_dump_hex(const void* data, size_t size);
......
......@@ -519,6 +519,27 @@ int send_select_break( )
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
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