git: 151495ac8dde - stable/14 - chflags(1): Fix -f option

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 06 Feb 2024 00:38:23 UTC
The branch stable/14 has been updated by kib:

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

commit 151495ac8ddeec3fed3c55963776699fde8c8c6b
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2024-01-29 22:17:47 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-06 00:37:37 +0000

    chflags(1): Fix -f option
    
    PR:     276723
    
    (cherry picked from commit fae467c2212ced8e82f5fa385d316445c8874941)
---
 bin/chflags/chflags.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c
index a08ac88ab3cd..5c9a2f7e7f42 100644
--- a/bin/chflags/chflags.c
+++ b/bin/chflags/chflags.c
@@ -195,9 +195,11 @@ main(int argc, char *argv[])
 		if (newflags == p->fts_statp->st_flags)
 			continue;
 		if (chflagsat(AT_FDCWD, p->fts_accpath, newflags,
-		    atflag) == -1 && !fflag) {
-			warn("%s", p->fts_path);
-			rval = 1;
+		    atflag) == -1) {
+			if (!fflag) {
+				warn("%s", p->fts_path);
+				rval = 1;
+			}
 		} else if (vflag || siginfo) {
 			(void)printf("%s", p->fts_path);
 			if (vflag > 1 || siginfo)