Commit b2bd10d4 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

[MDEV-9427] Server does not build on OpenSUSE 42.1

Changed code to comply to C90 standard.
parent 6d3ffd2e
...@@ -148,10 +148,6 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) ...@@ -148,10 +148,6 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
char input[32]; char input[32];
size_t len; size_t len;
len= my_snprintf(input, sizeof(input), "%p\n", ptr - offset);
if (write(in[1], input, len) <= 0)
return 1;
ssize_t total_bytes_read = 0; ssize_t total_bytes_read = 0;
ssize_t extra_bytes_read = 0; ssize_t extra_bytes_read = 0;
...@@ -160,6 +156,14 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) ...@@ -160,6 +156,14 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
FD_ZERO(&set); FD_ZERO(&set);
FD_SET(out[0], &set); FD_SET(out[0], &set);
int filename_start = -1;
int line_number_start = -1;
ssize_t i;
len= my_snprintf(input, sizeof(input), "%p\n", ptr - offset);
if (write(in[1], input, len) <= 0)
return 1;
/* 10 ms should be plenty of time for addr2line to issue a response. */ /* 10 ms should be plenty of time for addr2line to issue a response. */
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 10000; timeout.tv_usec = 10000;
...@@ -177,12 +181,10 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) ...@@ -177,12 +181,10 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
if (total_bytes_read == 0) if (total_bytes_read == 0)
return 1; return 1;
int filename_start = -1;
int line_number_start = -1;
/* Go through the addr2line response and get the required data. /* Go through the addr2line response and get the required data.
The response is structured in 2 lnes. The first line contains the function The response is structured in 2 lnes. The first line contains the function
name, while the second one contains <filename>:<line number> */ name, while the second one contains <filename>:<line number> */
for (ssize_t i = 0; i < total_bytes_read; i++) { for (i = 0; i < total_bytes_read; i++) {
if (output[i] == '\n') { if (output[i] == '\n') {
filename_start = i + 1; filename_start = i + 1;
output[i] = '\0'; output[i] = '\0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment