Commit cd504e49 authored by Davi Arnaut's avatar Davi Arnaut

Workaround a GCC warning about a pointer being cast to a larger

integral type. Use intptr which is designed to hold pointer values
and pass it to off_t.

mysys/stacktrace.c:
  Add a compile time assert to ensure that off_t is large enough
  to hold the pointer value.
parent d5e92895
...@@ -87,8 +87,11 @@ static int safe_print_str(const char *addr, int max_len) ...@@ -87,8 +87,11 @@ static int safe_print_str(const char *addr, int max_len)
if ((fd= open(buf, O_RDONLY)) < 0) if ((fd= open(buf, O_RDONLY)) < 0)
return -1; return -1;
/* Ensure that off_t can hold a pointer. */
compile_time_assert(sizeof(off_t) >= sizeof(intptr));
total= max_len; total= max_len;
offset= (off_t) addr; offset= (intptr) addr;
/* Read up to the maximum number of bytes. */ /* Read up to the maximum number of bytes. */
while (total) while (total)
......
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