Output on my machine:
~/foo $ ./a.out bar
Current working directory was: /foo
Changing directory...
Current working directory is now: /foo
buf
escapes local scope. May cause memory leak.
Very large code, macros could be reduced.
Suggestion: post to code review.se.