aboutsummaryrefslogtreecommitdiff
path: root/bin/rm
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2000-06-28 02:33:17 +0000
committerJosef Karthauser <joe@FreeBSD.org>2000-06-28 02:33:17 +0000
commit7c6e002bd54dbb299d39524acb8dda62e348c61a (patch)
tree45a6bd02c083978f1cbd06a85f5b21c6b509cecd /bin/rm
parenta588b737eef3d1ff92d4f42e80a339c264966533 (diff)
Notes
Diffstat (limited to 'bin/rm')
-rw-r--r--bin/rm/Makefile3
-rw-r--r--bin/rm/rm.c14
2 files changed, 7 insertions, 10 deletions
diff --git a/bin/rm/Makefile b/bin/rm/Makefile
index 2bbcdf89effc..7b85cdf90fc0 100644
--- a/bin/rm/Makefile
+++ b/bin/rm/Makefile
@@ -2,10 +2,9 @@
# $FreeBSD$
PROG= rm
-SRCS= rm.c setflags.c
+SRCS= rm.c
LINKS= ${BINDIR}/rm ${BINDIR}/unlink
MLINKS= rm.1 unlink.1
-.PATH: ${.CURDIR}/../../lib/libc/gen
.include <bsd.prog.mk>
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index 3c9071f45fb1..29c6aa7dfa56 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -61,8 +61,6 @@ static const char rcsid[] =
#include <sysexits.h>
#include <unistd.h>
-char *getflags __P((u_long, char *));
-
int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
uid_t uid;
@@ -424,7 +422,7 @@ check(path, name, sp)
struct stat *sp;
{
int ch, first;
- char modep[15], flagsp[128];
+ char modep[15], *flagsp;
/* Check -i first. */
if (iflag)
@@ -442,15 +440,15 @@ check(path, name, sp)
(!(sp->st_flags & (UF_APPEND|UF_IMMUTABLE)) || !uid)))
return (1);
strmode(sp->st_mode, modep);
- strcpy(flagsp, getflags(sp->st_flags, NULL));
- if (*flagsp)
- strcat(flagsp, " ");
- (void)fprintf(stderr, "override %s%s%s/%s %sfor %s? ",
+ if ((flagsp = fflagstostr(sp->st_flags)) == NULL)
+ err(1, NULL);
+ (void)fprintf(stderr, "override %s%s%s/%s %s%sfor %s? ",
modep + 1, modep[9] == ' ' ? "" : " ",
user_from_uid(sp->st_uid, 0),
group_from_gid(sp->st_gid, 0),
- *flagsp ? flagsp : "",
+ *flagsp ? flagsp : "", *flagsp ? " " : "",
path);
+ free(flagsp);
}
(void)fflush(stderr);