server2: break out of first and second loops if
pm_errno was set to non-zero
server2: add in some missing pacman logging from old function
fix return value of download function
server2: copy XferCommand from old function. it doesn't need modifying.
server2: add fcntl include
server2 -> server