I've written most of cp, but one issue keeps bugging me.
I can't figure out how to get rid of race conditions within the constraints that sbase is implemented in (POSIX 2001, no XSI extensions). If we were using POSIX 2008 or XSI extensions, I could use the at() functions, or at least fchdir(), to reliably solve this problem. As it is, I'm left with two choices: Emulate fchdir with a "magic cookie" struct containing an absolute path, device, and inode number [stat(".") every time and panic if device and inode number don't match the cookie] Do nothing. Any thoughts?