Date: Tue, 26 Nov 2002 21:12:30 +0900 (JST) From: AIDA Shinra <aida-s@jcom.home.ne.jp> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/45749: [PATCH] rm -f in MS-DOS directory Message-ID: <200211261212.gAQCCUqp002592@61-27-47-65.home.ne.jp>
next in thread | raw e-mail | index | archive | help
>Number: 45749
>Category: bin
>Synopsis: [PATCH] rm -f in MS-DOS directory
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Nov 26 04:20:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: AIDA Shinra
>Release: FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD e-note 4.7-STABLE FreeBSD 4.7-STABLE #2: Thu Nov 21 16:44:44 JST 2002 shinra@e-note:/usr/obj/usr/freebsd/src/sys/LOCAL i386
>Description:
For stat(), unlink() and others with an invalid filename fails with EINVAL on
msdosfs, rm(1) can't ignore such an argument even if -f is specified.
This means many usual commands such as "rm -f *.c" in empty directory fails in
"Invalid argument".
>How-To-Repeat:
>Fix:
Ignore EINVAL in addition to ENOENT.
diff -u -r1.1.1.2 -r1.3
--- rm.c 20 Jul 2002 11:31:00 -0000 1.1.1.2
+++ rm.c 26 Nov 2002 11:30:19 -0000 1.3
@@ -202,7 +202,8 @@
*/
if (!needstat)
break;
- if (!fflag || p->fts_errno != ENOENT) {
+ if (!fflag || (p->fts_errno != ENOENT
+ && p->fts_errno != EINVAL)) {
warnx("%s: %s",
p->fts_path, strerror(p->fts_errno));
eval = 1;
@@ -271,7 +272,9 @@
if (Pflag)
rm_overwrite(p->fts_accpath, NULL);
rval = unlink(p->fts_accpath);
- if (rval == 0 || (fflag && errno == ENOENT)) {
+ if (rval == 0 ||
+ (fflag && (errno == ENOENT
+ || errno == EINVAL))) {
if (rval == 0 && vflag)
(void)printf("%s\n",
p->fts_path);
@@ -304,7 +307,8 @@
if (Wflag) {
sb.st_mode = S_IFWHT|S_IWUSR|S_IRUSR;
} else {
- if (!fflag || errno != ENOENT) {
+ if (!fflag || (errno != ENOENT
+ && errno != EINVAL)) {
warn("%s", f);
eval = 1;
}
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211261212.gAQCCUqp002592>
