summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2016-01-17 22:23:21 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2016-01-17 22:26:22 +0200
commitb2bd10d4d614924ff22746ce3a49b4e5f755ddc9 (patch)
tree334142dc10d978f2f10adc622fb1dbe650a2eddb
parent6d3ffd2e3a76873acb4f232f52ccca6a75bf737d (diff)
downloadmariadb-git-b2bd10d4d614924ff22746ce3a49b4e5f755ddc9.tar.gz
[MDEV-9427] Server does not build on OpenSUSE 42.1
Changed code to comply to C90 standard.
-rw-r--r--mysys/my_addr_resolve.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index f9f40bc6ba5..d3d445ee95c 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -148,10 +148,6 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
char input[32];
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 extra_bytes_read = 0;
@@ -160,6 +156,14 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
FD_ZERO(&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. */
timeout.tv_sec = 0;
timeout.tv_usec = 10000;
@@ -177,12 +181,10 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
if (total_bytes_read == 0)
return 1;
- int filename_start = -1;
- int line_number_start = -1;
/* Go through the addr2line response and get the required data.
The response is structured in 2 lnes. The first line contains the function
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') {
filename_start = i + 1;
output[i] = '\0';