Clearly written by an idiot. Comparing segattach to -1 will break on architectures where pointers require more than 32-bits. (possibly other situations too(?)) Corrected diff attached.