aboutsummaryrefslogtreecommitdiff
path: root/bin/rm
Commit message (Collapse)AuthorAgeFilesLines
* Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* Put some static keywords in the source code.Ed Schouten2011-10-311-4/+4
| | | | | | | | | For these simple utilities, it doesn't harm to make all global variables static. In fact, this allows the compiler to perform better forms of optimisation and analysis. Notes: svn path=/head/; revision=226961
* bin: Prefer strrchr() to rindex().Jilles Tjoelker2011-03-151-1/+1
| | | | | | | This removes the last index/rindex usage from /bin. Notes: svn path=/head/; revision=219680
* Fix typo and grammar nitUlrich Spörlein2010-10-311-2/+2
| | | | | | | | Submitted by: arundel MFC after: 7 days (or when the bikeshed has abated) Notes: svn path=/head/; revision=214604
* Elaborate some more on the non-security implications of using -PUlrich Spörlein2010-10-311-6/+15
| | | | | | | | Submitted by: delphij Discussion at: svn-src-all Notes: svn path=/head/; revision=214596
* Language cleanup.Dag-Erling Smørgrav2010-10-271-3/+3
| | | | Notes: svn path=/head/; revision=214431
* rm(1): clarify that -P works only when blocks are updated in-placeUlrich Spörlein2010-10-082-6/+6
| | | | | | | Suggested by: pjd, ivoras, arundel Notes: svn path=/head/; revision=213582
* Clarify the combination effect of -P and -f to make it clear.Xin LI2010-10-041-3/+7
| | | | | | | | Submitted by: arundel MFC after: 2 weeks Notes: svn path=/head/; revision=213398
* rm, find -delete: fix removing symlinks with uchg/uappnd set.Jilles Tjoelker2009-05-301-3/+3
| | | | | | | | | | | | | | | Formerly, this tried to clear the flags on the symlink's target instead of the symlink itself. As before, this only happens for root or for the unlink(1) variant of rm. PR: bin/111226 (part of) Submitted by: Martin Kammerhofer Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=193087
* Implement ^T support for rm: now it will report the next file itWarner Losh2009-04-291-0/+29
| | | | | | | | | removes when you hit ^T. This is similar to what's done for cp. The signal handler and type definitions for "info" were borrowed directly from cp. Notes: svn path=/head/; revision=191670
* Give a hint to the reader as to what the "whiteout" actually means.Ruslan Ermilov2006-12-261-2/+3
| | | | Notes: svn path=/head/; revision=165555
* Fix markup, add the EXIT STATUS section.Ruslan Ermilov2006-12-261-7/+12
| | | | Notes: svn path=/head/; revision=165554
* Correct a security issue introduced in previous commit:Xin LI2006-10-312-3/+11
| | | | | | | | | | | | | | | | | | | | | | | instead of removing the file and issue a warning about the removal, do not do any operation at all in case -P is specified when the dinode has hard links. With -f and -P specified together, we assume that the user wants rm to overwrite the contents of the file and remove it (destroy the contents of file but leave its hard links as is). The reason of doing it this way is that, in case where a hard link is created by a malicious user (currently this is permitted even if the user has no access to the file). Losing the link can potentially mean that the actual owner would lose control completely to the user who wants to obtain access in a future day. Discussed with: Peter Jermey Notes: svn path=/head/; revision=163812
* Be more reasonable when overwrite mode is specified while thereXin LI2006-10-302-1/+8
| | | | | | | | | | | | is hard links. Overwritting when links > 1 would cause data loss, which is usually undesired. Inspired by: discussion on -hackers@ Suggested by: elessar at bsdforen de Obtained from: OpenBSD Notes: svn path=/head/; revision=163777
* o Backout rev. 1.55. Don't waste cpu cycles for bzero(), do notMaxim Konovalov2006-10-181-2/+1
| | | | | | | | | call chflags() for whiteouted files. Prodded by: ru Notes: svn path=/head/; revision=163485
* o Zero out struct stat before usage. lstat(2) can fail andMaxim Konovalov2006-10-181-0/+1
| | | | | | | | | | | leave garbage there which will break -W code path. PR: bin/84569 Submitted by: Igor MFC after: 2 weeks Notes: svn path=/head/; revision=163476
* o Be pedantic and do fts_close() when done.Maxim Konovalov2006-04-151-0/+1
| | | | | | | | | PR: bin/95292 Submitted by: Charles Hardin Obtained from: NetBSD via OpenBSD, PR Notes: svn path=/head/; revision=157770
* -mdoc sweep.Ruslan Ermilov2005-11-171-1/+1
| | | | Notes: svn path=/head/; revision=152547
* Give .Dd a tummy rub, forgotten on my last commit.Doug Barton2005-09-301-1/+1
| | | | Notes: svn path=/head/; revision=150742
* Handle the case where the -P flag is specified for a read-only fileDoug Barton2005-09-292-4/+9
| | | | | | | | | | | | | | | | | earlier, and more gracefully. Previously, this combination would be ignored early in the code where permissions are tested and fail later with a very unhelpful "permission denied" error. Instead, test for this flag in the same block that generates the "override?" messages for read-only files, but instead of trying to guess what the user has in mind, generate an error and exit. Update the man page to reflect this new behavior. Not objected to by: freebsd-hackers@ Notes: svn path=/head/; revision=150729
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-091-1/+2
| | | | Notes: svn path=/head/; revision=141578
* Remove unnecessary SRCS= where could be guessed directly by ourXin LI2005-01-271-1/+0
| | | | | | | | | bsd.*.mk infrasture. Obtained from: ru Notes: svn path=/head/; revision=140909
* Add the new standard EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-161-16/+16
| | | | | | | Sort standard sections in the (documented) preferred order. Notes: svn path=/head/; revision=140353
* /*- or .\"- or #- to begin license clauses.Warner Losh2005-01-101-0/+1
| | | | Notes: svn path=/head/; revision=139969
* UNIX conformance: If -r -f on non-existent directory, don't emit error.Jordan K. Hubbard2004-11-131-1/+4
| | | | Notes: svn path=/head/; revision=137639
* Correct a typo and make the documentation more mdoc(7) complaint.Xin LI2004-11-011-3/+3
| | | | | | | | Pointed out by: dd Approved by: murray (mentor) Notes: svn path=/head/; revision=137110
* Add -I, an option that asks for confirmation once if recursivelyXin LI2004-10-282-5/+70
| | | | | | | | | | | | | | | | | | | | | | | | removing directories or if more than 3 files are listed in the command line. This feature is intended to provide a safe net but not being too annoying like having "rm -i" for every deleting operations, and is generally good for both newbies and power users, preventing them from being so easily run into ``rm -rf /'', ``rm -rf *'' and so forth. Originally implemented by Matthew Dillon for DragonFly, plus some improvements done by various DragonFly contributors. Approved by: murray (mentor; the original dillon's version) Discussed with: des Obtained from: DragonFly's bin/rm/ rm.c rev. 1.4 - 1.8 rm.1 rev. 1.3 - 1.4 MFC After: 1 month Notes: svn path=/head/; revision=137009
* The previous commit added code to rm(1) to warn about and remove anyDag-Erling Smørgrav2004-10-041-1/+2
| | | | | | | | | | | | | | | | | | occurrences of "/" in the argument list. This corresponds to Enhancement Request Number 5 in the Austin Group TC2 Aardvark's XCU Defects Report (<URL:http://www.opengroup.org/austin/aardvark/finaltext/xcubug.txt>). Further discussion is available in the Austin Group mailing list archives (<URL:http://www.opengroup.org/austin/mailarchives/>, "Defect in XCU rm") and for Austin Group members, in the Austin Group Interpretations archive (<URL:http://www.opengroup.org/austin/interps/>, AI-019) This commit makes that check conditional on !POSIXLY_CORRECT, since it is not strictly correct according to the current version of the standard (but is expected to be correct according to the next version, and has already been adopted by Solaris). Notes: svn path=/head/; revision=136124
* Markup fixes.Dag-Erling Smørgrav2004-10-041-4/+4
| | | | | | | Pointed out by: ru Notes: svn path=/head/; revision=136123
* Find out how flame-proof my underwear really is.Dag-Erling Smørgrav2004-10-042-1/+25
| | | | Notes: svn path=/head/; revision=136113
* Whitespace cleanup.Dag-Erling Smørgrav2004-10-041-4/+4
| | | | Notes: svn path=/head/; revision=136112
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-2/+4
| | | | Notes: svn path=/head/; revision=131484
* Remove clause 3 from the UCB licenses.Mark Murray2004-04-062-8/+0
| | | | | | | OK'ed by: imp, core Notes: svn path=/head/; revision=127958
* o Fix a style bug and poor wording in comment.Jun Kuriyama2004-01-011-2/+10
| | | | | | | | | | | | o When fts_read() cannot stat the file, it can't be unlinked. At that case, don't display error message when -f flag is used. Obtained from: bde PR: kern/16815, bin/35842 Reported by: kuriyama, Aleksandr A. Babaylov <.@babolo.ru> Notes: svn path=/head/; revision=124041
* When the P flag is set (i.e. Overwrite regular files before deleting them),Guido van Rooij2003-11-101-8/+14
| | | | | | | | | | | | do only unlink the file if we could indeed overwrite the file. Old behaviour: rm -P /tmp/foo (foo mode 0444) would NOT overwrite foo, but still delete it (with a warning: rm: foo: Permission denied) New behaviour: Just the EPERM warning, but no deletion Reviewed by: bde Notes: svn path=/head/; revision=122409
* 1. Fixed leakage of a file descriptor for every non-fatal failure inBruce Evans2003-11-081-1/+3
| | | | | | | | | | | | | | | | | | rm_overwrite() (for rm -P). 2. Print the file name in the error message for (fatal) malloc() failures in rm_overwrite(). I first thought that malloc() failures should be non-fatal since they don't prevent proceeding the the next file, but making them non-fatal would normally give too much output for rm -Pr on a large tree in the unlikely event that even one occurs, since the malloc()ed amounts are usually the same. Just print the file name since the malloc()ed amounts are not always the same and it doesn't hurt to know where rm was when it quit. Submitted by: guido ((1) and original version of (2)) Notes: svn path=/head/; revision=122304
* Quiet warnings about copyright[].David E. O'Brien2003-05-011-2/+2
| | | | Notes: svn path=/head/; revision=114433
* Cross ref chflags(1).Tom Rhodes2003-02-041-0/+1
| | | | | | | Suggested by: Craig Carey <research@ijs.co.nz) on -doc. Notes: svn path=/head/; revision=110347
* s/filesystem/file system/ as discussed on -developersTom Rhodes2002-08-212-4/+4
| | | | Notes: svn path=/head/; revision=102230
* Revert previous delta, which is not required with rev 1.5 ofSheldon Hearn2002-07-151-1/+0
| | | | | | | src/contrib/gcc/c-format.c . Notes: svn path=/head/; revision=100069
* Complain if more than one file argument is given to unlink(1) like we didTim J. Robbins2002-07-121-1/+1
| | | | | | | before I made unlink use getopt(). Notes: svn path=/head/; revision=99858
* Set WFORMAT=0, because our compiler currently complains about NULLSheldon Hearn2002-07-111-0/+1
| | | | | | | | | | | | | | | | | | | | | arg 2 to err() and friends, and warnings are promoted to errors. This allows the following revisions to be reverted: rev 1.39 src/bin/cp/cp.c rev 1.26 src/bin/chmod/chmod.c rev 1.40 src/bin/rm/rm.c The following revisions can already be reverted, because they were already covered by WFORMAT=0: rev 1.8 src/bin/ls/lomac.c rev 1.63 src/bin/ls/ls.c rev 1.8 src/bin/ps/lomac.c rev 1.34 src/bin/rcp/rcp.c Notes: svn path=/head/; revision=99767
* err() is documented as allowing NULL for the format string but GCC isn'tMatthew Dillon2002-07-101-2/+2
| | | | | | | happy about it any more so change the usage to make buildworld work again. Notes: svn path=/head/; revision=99744
* Consistently use FBSDIDDavid E. O'Brien2002-06-301-3/+2
| | | | Notes: svn path=/head/; revision=99110
* Reject options, handle "--" correctly in unlink(1).Tim J. Robbins2002-05-301-4/+7
| | | | Notes: svn path=/head/; revision=97533
* Consistancy check s/file system/filesystem/Tom Rhodes2002-05-162-4/+4
| | | | | | | Reviewed by: brian Notes: svn path=/head/; revision=96702
* Update STANDARDS section on rm(1) to reflect current conformance.Doug White2002-03-021-16/+2
| | | | | | | PR: 35471 Notes: svn path=/head/; revision=91555
* Move user_from_uid to pwd.hWarner Losh2002-02-141-0/+2
| | | | | | | | | | | | | | | | Move group_from_gid to grp.h Remove from stdlib.h Make the prototypes match the code Fix rm and mv to include new files. NetBSD has these defined in those files, and others too that I've not done. Approved by: terminal room kabal Reviewed by: jhb, phk Notes: svn path=/head/; revision=90644
* o __P has been reovedWarner Losh2002-02-021-23/+13
| | | | | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. Notes: svn path=/head/; revision=90110
* Add prototypes for main() so that these programs compile with -WerrorLuigi Rizzo2001-12-141-0/+1
| | | | | | | | | | | | | | | (which somehow now seems to be the default for compiling -current). This error popped up while doing a PicoBSD cross-compile on a 4.3-ish system, it may well be that there are other apps which have similar problems, but I did not spot them as they are not included in my picobsd config. Whether adding prototypes for main() is the correct solution or not I have no idea, a request to -current on the matter went basically unanswered. Those who have better ideas are welcome to back this out and replace it with the correct fix. Notes: svn path=/head/; revision=87893