Skip to content

Commit b2bd10d

Browse files
committed
[MDEV-9427] Server does not build on OpenSUSE 42.1
Changed code to comply to C90 standard.
1 parent 6d3ffd2 commit b2bd10d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

mysys/my_addr_resolve.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
148148
char input[32];
149149
size_t len;
150150

151-
len= my_snprintf(input, sizeof(input), "%p\n", ptr - offset);
152-
if (write(in[1], input, len) <= 0)
153-
return 1;
154-
155151
ssize_t total_bytes_read = 0;
156152
ssize_t extra_bytes_read = 0;
157153

@@ -160,6 +156,14 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
160156
FD_ZERO(&set);
161157
FD_SET(out[0], &set);
162158

159+
int filename_start = -1;
160+
int line_number_start = -1;
161+
ssize_t i;
162+
163+
len= my_snprintf(input, sizeof(input), "%p\n", ptr - offset);
164+
if (write(in[1], input, len) <= 0)
165+
return 1;
166+
163167
/* 10 ms should be plenty of time for addr2line to issue a response. */
164168
timeout.tv_sec = 0;
165169
timeout.tv_usec = 10000;
@@ -177,12 +181,10 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
177181
if (total_bytes_read == 0)
178182
return 1;
179183

180-
int filename_start = -1;
181-
int line_number_start = -1;
182184
/* Go through the addr2line response and get the required data.
183185
The response is structured in 2 lnes. The first line contains the function
184186
name, while the second one contains <filename>:<line number> */
185-
for (ssize_t i = 0; i < total_bytes_read; i++) {
187+
for (i = 0; i < total_bytes_read; i++) {
186188
if (output[i] == '\n') {
187189
filename_start = i + 1;
188190
output[i] = '\0';

0 commit comments

Comments
 (0)