From: Jim Meyering Date: Tue, 4 Mar 2003 21:29:13 +0000 (+0000) Subject: (CLEANUP_CWD): Call error here, now that restore_cwd no longer does it. X-Git-Tag: v4.5.9~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca1b088722ef895ead8eeb465e9189aef3917dc4;p=thirdparty%2Fcoreutils.git (CLEANUP_CWD): Call error here, now that restore_cwd no longer does it. --- diff --git a/lib/makepath.c b/lib/makepath.c index a725e8597a..70038be781 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)