bin/74500: [PATCH] allow chflags to set flags on symlinks

Ceri Davies ceri at
Mon Nov 29 03:30:15 PST 2004

The following reply was made to PR bin/74500; it has been noted by GNATS.

From: Ceri Davies <ceri at>
To: Dan Nelson <dnelson at>
Cc: FreeBSD-gnats-submit at
Subject: Re: bin/74500: [PATCH] allow chflags to set flags on symlinks
Date: Mon, 29 Nov 2004 11:24:06 +0000

 On Sun, Nov 28, 2004 at 10:44:42PM -0600, Dan Nelson wrote:
 > /bin/chflags always calls chflags(2), which means that it drills
 > through symlinks and changes attricutes on the underlying files.  This
 > may not be what is intended if the user wants to prevent the symlink
 > itself from being changed (to point to a different location, for
 > example).
 > The prototypes for chflags and fchflags are also incorrect; they take
 > an int argument, not an unsigned long.
 > >How-To-Repeat:
 > >Fix:
 > Apply the following patch which adds the -h switch, copied from the
 > chown code.  A newer version may be at
 > .
 > @@ -72,6 +73,9 @@
 >  .It Fl R
 >  Change the file flags for the file hierarchies rooted
 >  in the files instead of just the files themselves.
 > +.It Fl h
 > +If the file is a symbolic link, change the user ID and/or the
 > +group ID of the link itself.
 A little bit *too* copied from chown? ;-)
 Only two things are infinite, the universe and human stupidity, and I'm
 not sure about the former.			  -- Einstein (attrib.)

More information about the freebsd-bugs mailing list