Add flag and error checking to the setuid code.