Hi tech.

Digging around the tree (Yes, i want try to contribute if possible),
i found this small piece of code:


>case 'f':              /* no longer documented. */
>       fflag = 1;
>       break;

And the usage of this flag in two conditional statement in a logic
OR:

>if (ischmod) {
>       if (!fchmodat(AT_FDCWD, p->fts_accpath, oct ? omode :
>           getmode(set, p->fts_statp->st_mode), atflags)
>           || fflag)
>               continue;
>} else if (!ischflags) {
>       if (!fchownat(AT_FDCWD, p->fts_accpath, uid, gid,
>           atflags) || fflag)
>               continue;

I checked the man pages related to chmod(1), chgrp(1), chflags(1) and
chown(8) and as the comment stated, nowhere the option is mentioned.
There is a motivation why the unused -f option is still there? As the
option is not documented anymore, this mean that fflag will be false
in every documented use case.
Anyway, attached a diff usable if the option can be removed.

Regards
Index: chmod.c
===================================================================
RCS file: /cvs/src/bin/chmod/chmod.c,v
retrieving revision 1.38
diff -u -p -r1.38 chmod.c
--- chmod.c     9 Oct 2015 01:37:06 -0000       1.38
+++ chmod.c     12 Nov 2015 20:51:28 -0000
@@ -62,7 +62,7 @@ main(int argc, char *argv[])
        unsigned long val;
        int oct;
        mode_t omode;
-       int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval, atflags;
+       int Hflag, Lflag, Rflag, ch, fts_options, hflag, rval, atflags;
        uid_t uid;
        gid_t gid;
        u_int32_t fclear, fset;
@@ -79,8 +79,8 @@ main(int argc, char *argv[])
 
        uid = (uid_t)-1;
        gid = (gid_t)-1;
-       Hflag = Lflag = Rflag = fflag = hflag = 0;
-       while ((ch = getopt(argc, argv, "HLPRXfghorstuwx")) != -1)
+       Hflag = Lflag = Rflag = hflag = 0;
+       while ((ch = getopt(argc, argv, "HLPRXghorstuwx")) != -1)
                switch (ch) {
                case 'H':
                        Hflag = 1;
@@ -96,9 +96,6 @@ main(int argc, char *argv[])
                case 'R':
                        Rflag = 1;
                        break;
-               case 'f':               /* no longer documented. */
-                       fflag = 1;
-                       break;
                case 'h':
                        hflag = 1;
                        break;
@@ -261,12 +258,11 @@ done:
 
                if (ischmod) {
                        if (!fchmodat(AT_FDCWD, p->fts_accpath, oct ? omode :
-                           getmode(set, p->fts_statp->st_mode), atflags)
-                           || fflag)
+                           getmode(set, p->fts_statp->st_mode), atflags))
                                continue;
                } else if (!ischflags) {
                        if (!fchownat(AT_FDCWD, p->fts_accpath, uid, gid,
-                           atflags) || fflag)
+                           atflags))
                                continue;
                } else {
                        if (!chflagsat(AT_FDCWD, p->fts_accpath, oct ? fset :

Reply via email to