usr.bin/undo: Fix error handling
As mentioned in the previous commit, collect_history() should
set error variable to errno when open(2) failed.
This commit does this by adding a new wrapper function for
collect_history() and renaming the existing collect_history()
to __collect_history(). The renamed collect_history() takes
const char* instead of fd and updates error if open(2) fails.
This is at least better although the error message changed
by the previous commit is still there without strerror().