# include <config.h>
#endif
+#include "makepath.h"
+
#include <alloca.h>
#include <stdio.h>
# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-#endif
+#include <stdlib.h>
#include <errno.h>
extern int errno;
#endif
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-# ifndef strchr
-# define strchr index
-# endif
-#endif
+#include <string.h>
#ifndef S_ISUID
# define S_ISUID 04000
#define WX_USR (S_IWUSR | S_IXUSR)
-#include "makepath.h"
-
#include "gettext.h"
#define _(msgid) gettext (msgid)
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)