1. return error instead of the trashed errno. 2. don't return -1, but return ENAMETOOLONG. 3. eliminate unused code.