Fix compile error and strip newline from variable in AIX.

Already reviewed by @McAtte.