diff options
Diffstat (limited to 'lib/makepath.c')
| -rw-r--r-- | lib/makepath.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/makepath.c b/lib/makepath.c index a725e8597..70038be78 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -117,10 +117,16 @@ extern int errno; Restore working directory. */ \ if (do_chdir) \ { \ - int _fail = restore_cwd (&cwd, NULL, NULL); \ + if (restore_cwd (&cwd) != 0) \ + { \ + int _saved_errno = errno; \ + error (0, errno, \ + _("failed to return to initial working directory")); \ + free_cwd (&cwd); \ + errno = _saved_errno; \ + return 1; \ + } \ free_cwd (&cwd); \ - if (_fail) \ - return 1; \ } \ } \ while (0) |
