Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Feb 2024 00:39:22 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: dc30b2841b7d - stable/13 - chflags(1): obey siginfo request on chflagsat(2) failure
Message-ID:  <202402060039.4160dMnX071580@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc30b2841b7d9903f543f69ac10c8ebe6c6ecc69

commit dc30b2841b7d9903f543f69ac10c8ebe6c6ecc69
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-30 18:07:59 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-06 00:38:35 +0000

    chflags(1): obey siginfo request on chflagsat(2) failure
    
    (cherry picked from commit 2954af09f143ed1e484f7ca520e0d2611101e248)
---
 bin/chflags/chflags.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c
index 81fb6708ae34..06cbd984128a 100644
--- a/bin/chflags/chflags.c
+++ b/bin/chflags/chflags.c
@@ -74,7 +74,7 @@ main(int argc, char *argv[])
 	u_long clear, newflags, set;
 	long val;
 	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
-	int ch, fts_options, oct, rval;
+	int ch, e, fts_options, oct, rval;
 	char *flags, *ep;
 
 	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
@@ -196,10 +196,16 @@ main(int argc, char *argv[])
 			continue;
 		if (chflagsat(AT_FDCWD, p->fts_accpath, newflags,
 		    atflag) == -1) {
+			e = errno;
 			if (!fflag) {
-				warn("%s", p->fts_path);
+				warnc(e, "%s", p->fts_path);
 				rval = 1;
 			}
+			if (siginfo) {
+				(void)printf("%s: %s\n", p->fts_path,
+				    strerror(e));
+				siginfo = 0;
+			}
 		} else if (vflag || siginfo) {
 			(void)printf("%s", p->fts_path);
 			if (vflag > 1 || siginfo)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402060039.4160dMnX071580>