striconveh: Simplify last commit.
[gnulib.git] / lib / save-cwd.c
index 7c2eb6d..cf43a35 100644 (file)
@@ -1,7 +1,7 @@
 /* save-cwd.c -- Save and restore current working directory.
 
-   Copyright (C) 1995, 1997, 1998, 2003, 2004, 2005, 2006, 2009 Free
-   Software Foundation, Inc.
+   Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2010 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
@@ -31,6 +31,7 @@
 #include "chdir-long.h"
 #include "unistd--.h"
 #include "xgetcwd.h"
+#include "cloexec.h"
 
 #if GNULIB_FCNTL_SAFER
 # include "fcntl--.h"
@@ -84,6 +85,7 @@ save_cwd (struct saved_cwd *cwd)
       return cwd->name ? 0 : -1;
     }
 
+  set_cloexec_flag (cwd->desc, true);
   return 0;
 }