X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsave-cwd.c;h=f842ccafc75623dc8184fd712f53e4b67c52379a;hb=f0216ef8e9e0726edbb361c5d275380ca312870f;hp=7f1b30b96ed928e25c9a36f3cd1ad15ebaadd499;hpb=222b0486b7db1b09293e05512873d633440efcb3;p=gnulib.git diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 7f1b30b96..f842ccafc 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -25,20 +25,14 @@ #include "save-cwd.h" +#include #include #include #include - -#if HAVE_UNISTD_H -# include -#endif - -#include - -#include +#include #include "chdir-long.h" -#include "unistd-safer.h" +#include "fcntl--.h" #include "xgetcwd.h" /* On systems without the fchdir function (WOE), pretend that open @@ -78,15 +72,11 @@ save_cwd (struct saved_cwd *cwd) { cwd->name = NULL; - cwd->desc = fd_safer (open (".", O_RDONLY)); + cwd->desc = open (".", O_RDONLY); if (cwd->desc < 0) { - cwd->desc = fd_safer (open (".", O_WRONLY)); - if (cwd->desc < 0) - { - cwd->name = xgetcwd (); - return cwd->name ? 0 : -1; - } + cwd->name = xgetcwd (); + return cwd->name ? 0 : -1; } return 0;