Another thing that you could add is a chdir("/"); which avoids having the program's cwd prevent the filesystem where the app was started from remounting. Not sure whether this completely fixes the problems people see during synchronization, but it should be at least a step in the right direction.

Another thing, you could look at is gpsapp. I wrapped several of the hijack ioctls in such a way that it gives an empeg application framework. When you compile natively on a UNIX system, it even gives you a small X11 window. Very useful for debugging and during development because you don't have to run gdb on the empeg all that often, and it is trivial to test for memory problems with programs like valgrind.
_________________________
40GB - serial #40104051 gpsapp