]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
mv, rm: adapt to new and improved gnulib interfaces
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Wed, 29 Apr 2009 07:48:15 +0000 (03:48 -0400)
committerJim Meyering <meyering@redhat.com>
Sun, 3 May 2009 17:12:16 +0000 (19:12 +0200)
Use gnulib's new priv-set module and updated write-any-file.
With them, the remove-called can_write_any_file function no
longer tries to drop the unlink-directory privilege, so now
each caller of remove must do that separately, calling
priv_set_remove_linkdir.
* bootstrap.conf (gnulib_modules): Add priv-set.
* src/rm.c: Include "priv-set.h".
(main): Call priv_set_remove_linkdir.
* src/mv.c (main): Likewise.
* gnulib: Update submodule to latest.

bootstrap.conf
gnulib
src/mv.c
src/rm.c

index 475dad4961ae6fd495e9b0128e7b6041129fa576..d8c7013c6e6f5bf04e7cdec3e7359ca101ae5f11 100644 (file)
@@ -160,6 +160,7 @@ gnulib_modules="
   posix-shell
   posixtm
   posixver
+  priv-set
   progname
   propername
   putenv
diff --git a/gnulib b/gnulib
index 9ccd438ce337e6fb8c95d9261f1e06a3952261c2..a771b77559753840d51609c779d526590e6a0144 160000 (submodule)
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 9ccd438ce337e6fb8c95d9261f1e06a3952261c2
+Subproject commit a771b77559753840d51609c779d526590e6a0144
index 061323632ea8398b12ad4a4b098dd99a3eec809e..8b9b6a11147bd56b8237ed6105f63be66a9251d9 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -32,6 +32,7 @@
 #include "quote.h"
 #include "remove.h"
 #include "root-dev-ino.h"
+#include "priv-set.h"
 
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "mv"
@@ -354,6 +355,9 @@ main (int argc, char **argv)
 
   cp_option_init (&x);
 
+  /* Try to disable the ability to unlink a directory.  */
+  priv_set_remove_linkdir ();
+
   /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
      we'll actually use backup_suffix_string.  */
   backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
index 8fecfdd5f29683a27d730e56499f626863a1b741..a70c559e868b995e8b9efab35070103b03b75c0d 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -55,6 +55,7 @@
 #include "remove.h"
 #include "root-dev-ino.h"
 #include "yesno.h"
+#include "priv-set.h"
 
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "rm"
@@ -241,6 +242,9 @@ main (int argc, char **argv)
 
   rm_option_init (&x);
 
+  /* Try to disable the ability to unlink a directory.  */
+  priv_set_remove_linkdir ();
+
   while ((c = getopt_long (argc, argv, "dfirvIR", long_opts, NULL)) != -1)
     {
       switch (c)