summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2009-04-29 18:08:18 +0000
committerWarner Losh <imp@FreeBSD.org>2009-04-29 18:08:18 +0000
commitb5260db6854b8ef5d34996af6a32080b892166d7 (patch)
treeffa30657da932ebee7e6fb5ce24f210fa40a482c /bin
parent7074cfa2231aa55c93957212691ca4e585c2c11d (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/rm/rm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index 25a984e7e5c4..f9316bcacab6 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
int rflag, Iflag;
uid_t uid;
+volatile sig_atomic_t info;
int check(char *, char *, struct stat *);
int check2(char **);
@@ -68,6 +69,7 @@ void checkslash(char **);
void rm_file(char **);
int rm_overwrite(char *, struct stat *);
void rm_tree(char **);
+static void siginfo(int __unused);
void usage(void);
/*
@@ -150,6 +152,7 @@ main(int argc, char *argv[])
checkslash(argv);
uid = geteuid();
+ (void)signal(SIGINFO, siginfo);
if (*argv) {
stdin_ok = isatty(STDIN_FILENO);
@@ -266,6 +269,11 @@ rm_tree(char **argv)
if (rval == 0 && vflag)
(void)printf("%s\n",
p->fts_path);
+ if (rval == 0 && info) {
+ info = 0;
+ (void)printf("%s\n",
+ p->fts_path);
+ }
continue;
}
break;
@@ -276,6 +284,11 @@ rm_tree(char **argv)
if (vflag)
(void)printf("%s\n",
p->fts_path);
+ if (info) {
+ info = 0;
+ (void)printf("%s\n",
+ p->fts_path);
+ }
continue;
}
break;
@@ -297,6 +310,11 @@ rm_tree(char **argv)
if (rval == 0 && vflag)
(void)printf("%s\n",
p->fts_path);
+ if (rval == 0 && info) {
+ info = 0;
+ (void)printf("%s\n",
+ p->fts_path);
+ }
continue;
}
}
@@ -369,6 +387,10 @@ rm_file(char **argv)
}
if (vflag && rval == 0)
(void)printf("%s\n", f);
+ if (info && rval == 0) {
+ info = 0;
+ (void)printf("%s\n", f);
+ }
}
}
@@ -592,3 +614,10 @@ usage(void)
" unlink file");
exit(EX_USAGE);
}
+
+static void
+siginfo(int sig __unused)
+{
+
+ info = 1;
+}