chdir returns -1 when it fails