X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsave-cwd.c;h=f07973a3ab3fafe2df657c5c526c44922861a324;hb=4ad44dd748d5da39555cdf305568280d69a23354;hp=5ad790a4d3542a7deafd4f5b9ac6325769e2b1da;hpb=d1eb42bdbbaf00d38b2a479e9aa40207b79bd090;p=gnulib.git diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 5ad790a4d..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,26 +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 - -#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 +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;