aboutsummaryrefslogtreecommitdiff
path: root/bin/rm/rm.c
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2000-06-17 14:19:33 +0000
committerJosef Karthauser <joe@FreeBSD.org>2000-06-17 14:19:33 +0000
commit141d77b8cb6272fbbad34df51417ca2797f01e12 (patch)
tree293c983836205dba2d6eec29a747ed131feb6900 /bin/rm/rm.c
parent0a266c86a2a8af315bba5524e1eea841f87feae7 (diff)
downloadsrc-141d77b8cb6272fbbad34df51417ca2797f01e12.tar.gz
src-141d77b8cb6272fbbad34df51417ca2797f01e12.zip
Switch over to using the new fflagstostr and strtofflags library calls.
Notes
Notes: svn path=/head/; revision=61749
Diffstat (limited to 'bin/rm/rm.c')
-rw-r--r--bin/rm/rm.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index c977373adddb..7d01346bd53e 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -60,8 +60,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;
@@ -423,7 +421,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)
@@ -441,15 +439,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);