X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fsave-cwd.c;fp=lib%2Fsave-cwd.c;h=1de4fb36293ca775cb53b672842e5a94bca670d8;hb=a8a88eddaa90432e6ec1b8d9d5c9842bc91afd1d;hp=27cb7507fe198177cfd30b5521424a36654426a7;hpb=20fcfc81ece044b8b0a6768ec6cf47be4e22a2e6;p=debian%2Fgzip
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index 27cb750..1de4fb3 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -1,6 +1,6 @@
/* save-cwd.c -- Save and restore current working directory.
- Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2016 Free Software
+ Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2018 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -14,7 +14,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see . */
+ along with this program. If not, see . */
/* Written by Jim Meyering. */
@@ -30,7 +30,6 @@
#include "chdir-long.h"
#include "unistd--.h"
-#include "cloexec.h"
#if GNULIB_FCNTL_SAFER
# include "fcntl--.h"
@@ -64,16 +63,15 @@ save_cwd (struct saved_cwd *cwd)
{
cwd->name = NULL;
- cwd->desc = open (".", O_SEARCH);
+ cwd->desc = open (".", O_SEARCH | O_CLOEXEC);
if (!GNULIB_FCNTL_SAFER)
- cwd->desc = fd_safer (cwd->desc);
+ cwd->desc = fd_safer_flag (cwd->desc, O_CLOEXEC);
if (cwd->desc < 0)
{
cwd->name = getcwd (NULL, 0);
return cwd->name ? 0 : -1;
}
- set_cloexec_flag (cwd->desc, true);
return 0;
}