]> Savannah Git Hosting - gnulib.git/commitdiff
save-cwd: don’t depend on fd-safer-flag, unistd-safer
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 6 Nov 2024 21:00:52 +0000 (13:00 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 6 Nov 2024 21:49:37 +0000 (13:49 -0800)
They aren’t needed in packages that use xstdopen
* lib/save-cwd.c: Do not include unistd--.h.
(GNULIB_FCNTL_SAFER): Do not define.
(save_cwd): Do not use fd_safer_flag, as the package should use
either fcntl-safer+unistd-safer or xstdopen if it cares about
closed stdin.
* modules/save-cwd (Depends-on): Remove fd-safer-flag, unistd-safer.

ChangeLog
lib/save-cwd.c
modules/save-cwd

index 97ef0310fefb550203e8de804a996f93bb7bc7a4..6ff94a961661f6071162745bca2b3ee9ccc3e8ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2024-11-06  Paul Eggert  <eggert@cs.ucla.edu>
 
+       save-cwd: don’t depend on fd-safer-flag, unistd-safer
+       They aren’t needed in packages that use xstdopen
+       * lib/save-cwd.c: Do not include unistd--.h.
+       (GNULIB_FCNTL_SAFER): Do not define.
+       (save_cwd): Do not use fd_safer_flag, as the package should use
+       either fcntl-safer+unistd-safer or xstdopen if it cares about
+       closed stdin.
+       * modules/save-cwd (Depends-on): Remove fd-safer-flag, unistd-safer.
+
        error: tune a bit for xstdopen
        * lib/error.c (flush_stdout): Also optimize if GNULIB_XSTDOPEN.
 
index 47f888c0bbd6695c59051360970c32abebbb152c..cf9405ebb5b3d8d28fb5f7349311c71922a31fea 100644 (file)
 #include <stdlib.h>
 
 #include "chdir-long.h"
-#include "unistd--.h"
 
 #if GNULIB_FCNTL_SAFER
 # include "fcntl--.h"
-#else
-# define GNULIB_FCNTL_SAFER 0
 #endif
 
 /* Record the location of the current working directory in CWD so that
@@ -63,8 +60,6 @@ save_cwd (struct saved_cwd *cwd)
   cwd->name = NULL;
 
   cwd->desc = open (".", O_SEARCH | O_CLOEXEC);
-  if (!GNULIB_FCNTL_SAFER)
-    cwd->desc = fd_safer_flag (cwd->desc, O_CLOEXEC);
   if (cwd->desc < 0)
     {
       cwd->name = getcwd (NULL, 0);
index 52bf3311df48e2f1639f3ef77ba47f52ec380a72..12eb8f1b9011cebed2efb5470d80f3f211553d74 100644 (file)
@@ -9,11 +9,9 @@ m4/save-cwd.m4
 Depends-on:
 chdir-long
 fchdir
-fd-safer-flag
 getcwd-lgpl
 open
 stdbool
-unistd-safer
 
 configure.ac:
 gl_SAVE_CWD