Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!uunet!not-for-mail From: sef@Kithrup.COM (Sean Eric Fagan) Newsgroups: comp.os.386bsd.bugs Subject: patch for bin/rm/rm.c Date: 22 Mar 1993 15:35:57 -0800 Organization: Kithrup Enterprises, Ltd. Lines: 137 Sender: sef@ftp.UU.NET Message-ID: <1oligtINN6mj@ftp.UU.NET> NNTP-Posting-Host: ftp.uu.net "rm -f" doesn't work properly; it actually complains. (How silly!) Here is a patch file that should fix it. *** rm.c.~1~ Mon Apr 8 14:52:58 1991 --- rm.c Mon Mar 22 15:29:40 1993 *************** *** 98,104 **** checkdot(argv); if (!*argv) ! exit(retval); stdin_ok = isatty(STDIN_FILENO); --- 98,104 ---- checkdot(argv); if (!*argv) ! exit(fflag ? 0 : retval); stdin_ok = isatty(STDIN_FILENO); *************** *** 106,112 **** rmtree(argv); else rmfile(argv); ! exit(retval); } rmtree(argv) --- 106,112 ---- rmtree(argv); else rmfile(argv); ! exit(fflag ? 0 : retval); } rmtree(argv) *************** *** 131,137 **** if (!(fts = fts_open(argv, needstat ? FTS_PHYSICAL : FTS_PHYSICAL|FTS_NOSTAT, ! (int (*)())NULL))) { (void)fprintf(stderr, "rm: %s.\n", strerror(errno)); exit(1); } --- 131,137 ---- if (!(fts = fts_open(argv, needstat ? FTS_PHYSICAL : FTS_PHYSICAL|FTS_NOSTAT, ! (int (*)())NULL)) && !fflag) { (void)fprintf(stderr, "rm: %s.\n", strerror(errno)); exit(1); } *************** *** 181,187 **** if (errno == ENOENT) { if (fflag) continue; ! } else if (p->fts_info != FTS_DP) (void)fprintf(stderr, "rm: unable to read %s.\n", p->fts_path); } else if (!unlink(p->fts_accpath) || fflag && errno == ENOENT) --- 181,187 ---- if (errno == ENOENT) { if (fflag) continue; ! } else if (p->fts_info != FTS_DP && !fflag) (void)fprintf(stderr, "rm: unable to read %s.\n", p->fts_path); } else if (!unlink(p->fts_accpath) || fflag && errno == ENOENT) *************** *** 209,215 **** error(f, errno); continue; } ! if (S_ISDIR(sb.st_mode) && !df) { (void)fprintf(stderr, "rm: %s: is a directory\n", f); retval = 1; continue; --- 209,215 ---- error(f, errno); continue; } ! if (S_ISDIR(sb.st_mode) && !df && !fflag) { (void)fprintf(stderr, "rm: %s: is a directory\n", f); retval = 1; continue; *************** *** 241,246 **** --- 241,247 ---- if (S_ISLNK(sp->st_mode) || !stdin_ok || !access(name, W_OK)) return(1); strmode(sp->st_mode, modep); + if (!fflag) (void)fprintf(stderr, "override %s%s%s/%s for %s? ", modep + 1, modep[9] == ' ' ? "" : " ", user_from_uid(sp->st_uid, 0), *************** *** 268,274 **** else p = *t; if (ISDOT(p)) { ! if (!complained++) (void)fprintf(stderr, "rm: \".\" and \"..\" may not be removed.\n"); retval = 1; --- 269,275 ---- else p = *t; if (ISDOT(p)) { ! if (!complained++ && !fflag) (void)fprintf(stderr, "rm: \".\" and \"..\" may not be removed.\n"); retval = 1; *************** *** 283,288 **** --- 284,290 ---- char *name; int val; { + if (!fflag) (void)fprintf(stderr, "rm: %s: %s.\n", name, strerror(val)); retval = 1; } *************** *** 289,294 **** --- 291,297 ---- usage() { + if (!fflag) (void)fprintf(stderr, "usage: rm [-dfiRr] file ...\n"); exit(1); }