in reply to check if chdir() has work

Of course Corion's suggestion is the best, but if you still mistrust the return value (there's no reason, mind) you can still compare the current dirctory (see Cwd) to chdir's target value.