Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/rm Don't ask for permission to unlink a file if the acce...



details:   https://anonhg.NetBSD.org/src/rev/25c7e96d7150
branches:  trunk
changeset: 474167:25c7e96d7150
user:      is <is%NetBSD.org@localhost>
date:      Wed Jun 30 10:18:59 1999 +0000

description:
Don't ask for permission to unlink a file if the access error is ETXTBSY.
This needs vfs_syscalls.c 1.138 to really work.
Fixes pr 4134 by Johan Danielsson.

diffstat:

 bin/rm/rm.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r b91f4f07dec7 -r 25c7e96d7150 bin/rm/rm.c
--- a/bin/rm/rm.c       Wed Jun 30 10:00:06 1999 +0000
+++ b/bin/rm/rm.c       Wed Jun 30 10:18:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rm.c,v 1.24 1998/07/28 11:41:51 mycroft Exp $  */
+/*     $NetBSD: rm.c,v 1.25 1999/06/30 10:18:59 is Exp $       */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)rm.c       8.8 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: rm.c,v 1.24 1998/07/28 11:41:51 mycroft Exp $");
+__RCSID("$NetBSD: rm.c,v 1.25 1999/06/30 10:18:59 is Exp $");
 #endif
 #endif /* not lint */
 
@@ -377,7 +377,8 @@
                 * because their permissions are meaningless.  Check stdin_ok
                 * first because we may not have stat'ed the file.
                 */
-               if (!stdin_ok || S_ISLNK(sp->st_mode) || !access(name, W_OK))
+               if (!stdin_ok || S_ISLNK(sp->st_mode) ||
+                       !(access(name, W_OK) && (errno != ETXTBSY)))
                        return (1);
                strmode(sp->st_mode, modep);
                (void)fprintf(stderr, "override %s%s%s/%s for %s? ",



Home | Main Index | Thread Index | Old Index