Fixes #3777: Move r29196 to v1.7 (save return code)

---svn-pre-commit-ignore-below---

r29196 [[BR]]
Save the error code.