From: deraadt Date: Thu, 8 Oct 2015 13:17:06 +0000 (+0000) Subject: the -P flag overwrites files, so it needs tame "stdio rpath wpath cpath". X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d5cafc5de625d6e3bcbf3ab2d8925023cba4612d;p=openbsd the -P flag overwrites files, so it needs tame "stdio rpath wpath cpath". the remaining code paths can use tame "stdio rpath cpath". One again, the "cpath" request says a path-based system call will be used to "change" filesystem pathname layout, for instance any of O_CREAT, symlink, rename, unlink... --- diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 833d3039b97..4ac36e259bf 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rm.c,v 1.30 2015/01/16 06:39:32 deraadt Exp $ */ +/* $OpenBSD: rm.c,v 1.31 2015/10/08 13:17:06 deraadt Exp $ */ /* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */ /*- @@ -102,6 +102,14 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (Pflag) { + if (tame("stdio rpath wpath cpath", NULL) == -1) + err(1, "tame"); + } else { + if (tame("stdio rpath cpath", NULL) == -1) + err(1, "tame"); + } + if (argc < 1 && fflag == 0) usage();