aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2018-03-07 01:55:38 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2018-03-07 01:55:38 +0000
commitfdee29d7d5d11ea64ca9d27c4d3ffe933eeb3b4e (patch)
tree47ef699c61f2c686c6502439ff77a73e82b21d85 /bin
parent0cc4c55e45d47bc90248a20750c21c7d8280dfa4 (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/chflags/chflags.112
-rw-r--r--bin/chflags/chflags.c17
2 files changed, 26 insertions, 3 deletions
diff --git a/bin/chflags/chflags.1 b/bin/chflags/chflags.1
index 6966f6c0fbc4..942cfe9bf137 100644
--- a/bin/chflags/chflags.1
+++ b/bin/chflags/chflags.1
@@ -32,7 +32,7 @@
.\" @(#)chflags.1 8.4 (Berkeley) 5/2/95
.\" $FreeBSD$
.\"
-.Dd March 4, 2018
+.Dd March 6, 2018
.Dt CHFLAGS 1
.Os
.Sh NAME
@@ -217,6 +217,16 @@ setting.
See
.Xr security 7
for more information on this setting.
+.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+signal (see the
+.Cm status
+argument for
+.Xr stty 1 ) ,
+then the current filename as well as the old and new flags are displayed.
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c
index 3121f470e13a..c1d9c18b9b6b 100644
--- a/bin/chflags/chflags.c
+++ b/bin/chflags/chflags.c
@@ -51,13 +51,23 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fcntl.h>
#include <fts.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+static volatile sig_atomic_t siginfo;
+
static void usage(void);
+static void
+siginfo_handler(int sig __unused)
+{
+
+ siginfo = 1;
+}
+
int
main(int argc, char *argv[])
{
@@ -108,6 +118,8 @@ main(int argc, char *argv[])
if (argc < 2)
usage();
+ (void)signal(SIGINFO, siginfo_handler);
+
if (Rflag) {
if (hflag)
errx(1, "the -R and -h options may not be "
@@ -188,13 +200,14 @@ main(int argc, char *argv[])
atflag) == -1 && !fflag) {
warn("%s", p->fts_path);
rval = 1;
- } else if (vflag) {
+ } else if (vflag || siginfo) {
(void)printf("%s", p->fts_path);
- if (vflag > 1)
+ if (vflag > 1 || siginfo)
(void)printf(": 0%lo -> 0%lo",
(u_long)p->fts_statp->st_flags,
newflags);
(void)printf("\n");
+ siginfo = 0;
}
}
if (errno)