summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-03-04 21:29:13 +0000
committerJim Meyering <jim@meyering.net>2003-03-04 21:29:13 +0000
commitca1b088722ef895ead8eeb465e9189aef3917dc4 (patch)
treebcba1fec2d64046fc6347e02b0f3ee734e3ac89b /lib
parent6c08bfe83fd93354e3356001f5b49286faf7baf9 (diff)
downloadcoreutils-ca1b088722ef895ead8eeb465e9189aef3917dc4.tar.xz
(CLEANUP_CWD): Call error here, now that restore_cwd no longer does it.
Diffstat (limited to 'lib')
-rw-r--r--lib/makepath.c12
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)