(CLEANUP_CWD): Call error here, now that restore_cwd no longer does it.
authorJim Meyering <jim@meyering.net>
Tue, 4 Mar 2003 21:29:13 +0000 (21:29 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 4 Mar 2003 21:29:13 +0000 (21:29 +0000)
lib/makepath.c

index a725e85..70038be 100644 (file)
@@ -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)