X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fsave-cwd.c;h=f07973a3ab3fafe2df657c5c526c44922861a324;hb=7a97de48ca71de5fd6fac6d27f8d131d17e7fc9a;hp=b3d09965db8cea9dda6166abc46789aaaaea2bcc;hpb=267a39bafd249d7eb9c37df06dc6defcf41cb343;p=gnulib.git diff --git a/lib/save-cwd.c b/lib/save-cwd.c index b3d09965d..f07973a3a 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -1,7 +1,7 @@ /* save-cwd.c -- Save and restore current working directory. - Copyright (C) 1995, 1997, 1998, 2003, 2004, 2005 Free Software - Foundation, Inc. + Copyright (C) 1995, 1997, 1998, 2003, 2004, 2005, 2006 Free + Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,30 +19,18 @@ /* Written by Jim Meyering. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include #include "save-cwd.h" +#include #include #include #include - -#if HAVE_UNISTD_H -# include -#endif - -#if HAVE_FCNTL_H -# include -#else -# include -#endif - -#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 @@ -82,15 +70,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;