Getting segmentation fault SIGSEGV in memcpy after mmap

前端 未结 4 1810
既然无缘
既然无缘 2021-01-23 16:50

I wrote a simple Android native function that get a filename and some more arguments and read the file by mmapping (mmap) it\'s memory.

Because it\'s mmap, I don\'t real

4条回答
  •  佛祖请我去吃肉
    2021-01-23 17:09

    This loop never terminates because ret_val always equals buffer

    void *ret_val = buffer;
    int read_length = length;
    while(ret_val == buffer || read_length

    memcpy always returns it's first argument, so ret_val never changes.

提交回复
热议问题