I used to be an expert in SDL 1.2 but I haven't touched SDL 2 yet, so I thought I'd take a look at your code. It was very puzzling, I have to say. You're getting SIGBUS or SIGSEGV whenever SDL_Quit() is called, and in the meantime SDL_Event() is not returning anything, for any type of event. (This is easy to see, just print a message right before/after SDL_Quit() and inside the event loop.) Yet your code is very similar to the lazy foo example that does work.

And you're not the only one with this problem: dsource.org - forums

But the solution (in your case) turns out to be pretty bizarre. It's your function named close(). Somewhere deep inside SDL (or more likely the new X/Wayland stuff) there is a dependency on a function of the same name; if I install SDL 2 debugging info (libsdl2-dbg) I can see a dependency on
Code:
close@@GLIBC_2.2.5
Well, that's just the standard close() syscall inside libc (man 2 close). And your close is overriding it. SDL is opening and closing file descriptors repeatedly as it opens a window (95 times actually), but when it tries to close() a file descriptor, it actually calls your close function (and SDL_Quit!).

So the solution is just to rename your close function to something else; I used my_close. Amusingly, compiling your code as C++ also causes it to work, because C++ will mangle the function name into _Z7__closev, which doesn't conflict with the built-in close. The take-away from this is to be careful not to use built-in function names. But you can't always know what those are, so try to always have a known good version of your program. Make small changes, compile, and test. When it breaks, you can ask yourself, what did I just introduce?