25 |
|
|
26 |
#include "save-cwd.h" |
#include "save-cwd.h" |
27 |
|
|
28 |
|
#include <errno.h> |
29 |
#include <stdbool.h> |
#include <stdbool.h> |
30 |
#include <stdio.h> |
#include <stdio.h> |
31 |
#include <stdlib.h> |
#include <stdlib.h> |
32 |
|
#include <unistd.h> |
|
#if HAVE_UNISTD_H |
|
|
# include <unistd.h> |
|
|
#endif |
|
|
|
|
|
#include <fcntl.h> |
|
|
|
|
|
#include <errno.h> |
|
33 |
|
|
34 |
#include "chdir-long.h" |
#include "chdir-long.h" |
35 |
#include "unistd-safer.h" |
#include "fcntl--.h" |
36 |
#include "xgetcwd.h" |
#include "xgetcwd.h" |
37 |
|
|
38 |
/* On systems without the fchdir function (WOE), pretend that open |
/* On systems without the fchdir function (WOE), pretend that open |
72 |
{ |
{ |
73 |
cwd->name = NULL; |
cwd->name = NULL; |
74 |
|
|
75 |
cwd->desc = fd_safer (open (".", O_RDONLY)); |
cwd->desc = open (".", O_RDONLY); |
76 |
if (cwd->desc < 0) |
if (cwd->desc < 0) |
77 |
{ |
{ |
78 |
cwd->desc = fd_safer (open (".", O_WRONLY)); |
cwd->desc = open (".", O_WRONLY); |
79 |
if (cwd->desc < 0) |
if (cwd->desc < 0) |
80 |
{ |
{ |
81 |
cwd->name = xgetcwd (); |
cwd->name = xgetcwd (); |