Sude-/lgogdownloader — pull request #2 by rkj (2013-11-02 14:59:10+00:00)
Title: Fix Downloader::writeData to use streams

After last system update old code stopped working for me, I poked a bit, and it core dumped in this method.
Some gdb output:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5bd5d5d in __GI__IO_fwrite (buf=0x687e9b, size=1, count=15957, fp=0x7fffffffcea0) at iofwrite.c:41
41 iofwrite.c: No such file or directory.
(gdb) p fp
$1 = (_IO_FILE *) 0x7fffffffcea0
(gdb) up
#1 0x0000000000434be0 in Downloader::writeData (ptr=0x687e9b, size=1, nmemb=15957, stream=0x7fffffffcea0) at src/downloader.cpp:1155
1155 return fwrite(ptr, size, nmemb, stream);

...
(gdb) bt
#0 0x00007ffff5bd5d5d in __GI__IO_fwrite (buf=0x687e9b, size=1, count=15957, fp=0x7fffffffcea0) at iofwrite.c:41
#1 0x0000000000434be0 in Downloader::writeData (ptr=0x687e9b, size=1, nmemb=15957, stream=0x7fffffffcea0) at src/downloader.cpp:1155
#2 0x00007ffff7b8a390 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#3 0x00007ffff7ba2308 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#4 0x00007ffff7bab5e7 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#5 0x00007ffff7babd41 in curl_multi_perform () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#6 0x00007ffff7ba3467 in curl_easy_perform () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#7 0x000000000043520a in Downloader::HTTP_Login (this=0x7fffffffd900, email=..., password=...) at src/downloader.cpp:1206
#8 0x000000000042df0f in Downloader::login (this=0x7fffffffd900) at src/downloader.cpp:115
#9 0x000000000042dc84 in Downloader::init (this=0x7fffffffd900) at src/downloader.cpp:76
#10 0x0000000000413172 in main (argc=4, argv=0x7fffffffdd28) at main.cpp:192