#include <assert.h>
#include <errno.h>
#include <fcntl.h>
+#include <signal.h>
#include <stdbool.h>
#include <sys/types.h>
#include <sys/wait.h>
/* Open the directory if requested, or if avoiding a race condition
is requested and possible. */
- if (open_result || (options & (O_NOFOLLOW ? SAVEWD_CHDIR_NOFOLLOW : 0)))
+ if (open_result
+ || (options & (HAVE_WORKING_O_NOFOLLOW ? SAVEWD_CHDIR_NOFOLLOW : 0)))
{
fd = open (dir,
(O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
_exit (status);
if (0 < child)
{
- int status;
- while (waitpid (child, &status, 0) < 0)
+ int child_status;
+ while (waitpid (child, &child_status, 0) < 0)
assert (errno == EINTR);
wd->val.child = -1;
- if (! WIFEXITED (status))
- raise (WTERMSIG (status));
- return WEXITSTATUS (status);
+ if (! WIFEXITED (child_status))
+ raise (WTERMSIG (child_status));
+ return WEXITSTATUS (child_status);
}
}
break;