Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Sep 2002 08:20:46 +0200
From:      Johan Karlsson <johan@FreeBSD.org>
To:        Tom Rhodes <trhodes@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, bde@FreeBSD.org, jhb@FreeBSD.org, ru@FreeBSD.org
Subject:   Re: cvs commit: src/bin/chmod chmod.1 chmod.c
Message-ID:  <20020918062046.GB8620@numeri.campus.luth.se>
In-Reply-To: <200209172338.g8HNcXjJ026355@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi

On Tue, Sep 17, 2002 at 16:38 (-0700) +0000, Tom Rhodes wrote:
> trhodes     2002/09/17 16:38:33 PDT
> 
>   Modified files:        (Branch: RELENG_4)
>     bin/chmod            chmod.1 chmod.c 
>   Log:
>   MFC: 'h' missing in getopt() call

I'm still missing the functional change in rev 1.21 of chmod.c

This cut-n-pasted part of that change has not yet been MFCed.

====
@@ -102,9 +103,10 @@ main(argc, argv)
                        /*
                         * In System V (and probably POSIX.2) the -h option
                         * causes chmod to change the mode of the symbolic
-                        * link.  4.4BSD's symbolic links don't have modes,
-                        * so it's an undocumented noop.  Do syntax checking,
-                        * though.
+                        * link.  4.4BSD's symbolic links didn't have modes,
+                        * so it was an undocumented noop.  In FreeBSD 3.0,
+                        * lchmod(2) is introduced and this option does real
+                        * work.
                         */
                        hflag = 1;
                        break;
@@ -148,6 +150,11 @@ done:      argv += optind;
        } else
                fts_options = FTS_LOGICAL;
 
+       if (hflag)
+               change_mode = lchmod;
+       else
+               change_mode = chmod;
+
        mode = *argv;
        if (*mode >= '0' && *mode <= '7') {
                errno = 0;
@@ -190,14 +197,17 @@ done:     argv += optind;
                         * don't point to anything and ones that we found
                         * doing a physical walk.
                         */
-                       continue;
+                       if (!hflag)
+                               continue;
+                       /* else */
+                       /* FALLTHROUGH */
                default:
                        break;
                }
                newmode = oct ? omode : getmode(set, p->fts_statp->st_mode);
                if ((newmode & ALLPERMS) == (p->fts_statp->st_mode & ALLPERMS))
                        continue;
-               if (chmod(p->fts_accpath, newmode) && !fflag) {
+               if ((*change_mode)(p->fts_accpath, newmode) && !fflag) {
                        warn("%s", p->fts_path);
                        rval = 1;
                } else {
=======


Bruce, Ruslan, is this something that should be MFCed as well
or do we only want to document the faked support for -h?

/Johan K


>   
>   PR:             41926
>   Submitted by:   Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
>   Reviewed by:    johan, bde, jhb
>   Approved by:    re (jhb)
>   
>   Revision   Changes    Path
>   1.17.2.11  +1 -1      src/bin/chmod/chmod.1
>   1.16.2.4   +3 -3      src/bin/chmod/chmod.c

-- 
Johan Karlsson		mailto:johan@FreeBSD.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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