Mercurial > hg > octave-nkf > gnulib-hg
changeset 4545:07ae239e387f
(CLEANUP_CWD): Report an error if we failed to return to the initial
working directory. Preserve errno for caller.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Thu, 14 Aug 2003 23:07:29 +0000 |
parents | 9a6a29a7ae3c |
children | 2393f6b7cc42 |
files | lib/makepath.c |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/makepath.c +++ b/lib/makepath.c @@ -105,10 +105,16 @@ 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)