History log of /freebsd-current/bin/chflags/chflags.c
Revision Date Author Comments
# 2954af09 30-Jan-2024 Konstantin Belousov <kib@FreeBSD.org>

chflags(1): obey siginfo request on chflagsat(2) failure

Note that the error diagnostic can now be printed both to stderr due to
the absence of the -f flag and to stdout due to SIGINFO simultaneously.

Noted and reviewed by: jrtc27
Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# fae467c2 29-Jan-2024 Ricardo Branco <rbranco@suse.de>

chflags(1): Fix -f option

As stated in the man page, -f must not emit warning on error, and must
not set the utility exit code.

PR: 276723
Github PR: https://github.com/freebsd/freebsd-src/pull/1088
Reviewed by: imp, kib
MFC after: 1 week


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# e9746806 07-Jul-2023 Alfonso Gregory <gfunni234@gmail.com>

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735


# 2dfa4b66 08-Dec-2020 Bryan Drewery <bdrewery@FreeBSD.org>

fts_read: Handle error from a NULL return better.

This is addressing cases such as fts_read(3) encountering an [EIO]
from fchdir(2) when FTS_NOCHDIR is not set. That would otherwise be
seen as a successful traversal in some of these cases while silently
discarding expected work.

As noted in r264201, fts_read() does not set errno to 0 on a successful
EOF so it needs to be set before calling it. Otherwise we might see
a random error from one of the iterations.

gzip is ignoring most errors and could be improved separately.

Reviewed by: vangyzen
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D27184


# fdee29d7 06-Mar-2018 Bryan Drewery <bdrewery@FreeBSD.org>

chflags: Add SIGINFO support.

This is copied from chmod r311668.

MFC after: 2 weeks


# 25d90d5c 04-Mar-2018 Bryan Drewery <bdrewery@FreeBSD.org>

chflags: Add -x option to not traverse mount points.

MFC after: 2 weeks


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# ad34cace 28-Apr-2015 Steven Hartland <smh@FreeBSD.org>

Standardise chmod, chflags, chown and chgrp recursive symlink processing

chmod, chflags, chgrp, chmod and chown now affect symlinks in -R mode as
defined in symlink(7); previously symlinks were silently ignored.

Differential Revision: https://reviews.freebsd.org/D2316
Reviewed by: jilles
MFC after: 1 month
Relnotes: yes
Sponsored by: Multiplay


# b4b2596b 21-Mar-2013 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Make 'flags' argument to chflags(2), fchflags(2) and lchflags(2) of type
u_long. Before this change it was of type int for syscalls, but prototypes
in sys/stat.h and documentation for chflags(2) and fchflags(2) (but not
for lchflags(2)) stated that it was u_long. Now some related functions
use u_long type for flags (strtofflags(3), fflagstostr(3)).
- Make path argument of type 'const char *' for consistency.

Discussed on: arch
Sponsored by: The FreeBSD Foundation


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 431586a8 23-Jun-2009 Xin LI <delphij@FreeBSD.org>

Staticify internal routines.


# a6412d5d 24-May-2009 Jilles Tjoelker <jilles@FreeBSD.org>

Fix chflags -h in various cases: do not use link target's flags as original.

Patch slightly changed to align more with chmod.c.

PR: bin/131999
Submitted by: bde
Approved by: ed (mentor)
MFC after: 3 weeks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 1b21ffa6 08-Mar-2008 Robert Watson <rwatson@FreeBSD.org>

Make chflags(1) more chmod(1)-like (and more feature complete):

- Add -v to print file names as they are processed; -vv prints the flags
change as well.
- Add -f to ignore failures with the same semantics as chflags(1), neither
printing an error nor affecting the return code.
- Don't try to set the flags if they won't change.

I made minor cosmetic tweaks to the code in the patch.

MFC after: 1 week
PR: 112827
Submitted by: Ighighi <ighighi at gmail.com>


# 7e81a152 14-May-2005 Dima Dorfman <dd@FreeBSD.org>

Add an interface to the lchflags(2) syscall. The new -h option is
analogous to chmod(1)'s -h. It allows setting flags on symbolic links,
which *do* exist in 5.x+ despite a claim to the contrary in the
chflags(1) man page.

Suggested by: Chris Dillon


# 9ddb49cb 10-Jan-2005 Warner Losh <imp@FreeBSD.org>

/*- or .\"- or #- to begin license clauses.


# 26663dcb 03-Oct-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Garbage collect a variable whose value was never read.


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 3004d1ed 18-Feb-2004 Ceri Davies <ceri@FreeBSD.org>

Only call chflags() on directories once.

Approved by: ru
MFC after: 1 week


# dbd64020 01-May-2003 David E. O'Brien <obrien@FreeBSD.org>

Make GCC 3.3 STFU about copyright[].


# f4ac32de 04-Sep-2002 David Malone <dwmalone@FreeBSD.org>

ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by: md5


# 3a7fc8ce 18-Aug-2002 Juli Mallett <jmallett@FreeBSD.org>

Remove local prototypes for main().


# f1bb2cd2 21-Mar-2002 Warner Losh <imp@FreeBSD.org>

remove __P


# 9f5b04e9 10-Dec-2001 David Malone <dwmalone@FreeBSD.org>

Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.


# f614104a 02-Dec-2001 Mark Murray <markm@FreeBSD.org>

Slight makefile style.

Use __FBSDID().


# 8e46d9c2 27-May-2001 Ruslan Ermilov <ru@FreeBSD.org>

Follow symbolic links named as command line arguments if run without -R.

This is required by symlink(7), ``Commands not traversing a file tree''
subsection, third paragraph:

: It is important to realize that this rule includes commands which may
: optionally traverse file trees, e.g. the command ``chown file'' is
: included in this rule, while the command ``chown -R file'' is not.

For chown(8) and chgrp(1), this is also is compliance with the latest
POSIX 1003.1-200x draft.

MFC after: 1 week


# bfa27aef 20-May-2001 Kris Kennaway <kris@FreeBSD.org>

Silence WARNS=2 and BDECFLAGS on alpha and i386

MFC after: 1 week


# 141d77b8 17-Jun-2000 Josef Karthauser <joe@FreeBSD.org>

Switch over to using the new fflagstostr and strtofflags library calls.


# 508424d1 04-Apr-2000 Bruce Evans <bde@FreeBSD.org>

Fixed prototype for setflags(). setflags() returns int, not u_long,
and "extern" in function prototypes is a style bug. The type mismatch
broke chflags(1) on i386's with 64-bit longs and may have broken it on
alphas.


# 418d67b0 05-Feb-2000 Josef Karthauser <joe@FreeBSD.org>

Revert part of the last commit, remove {g|s}etflags from the libc
interface, and statically link them to the programs using them.
These functions, upon reflection and discussion, are too generically
named for a library interface with such specific functionality.
Also the api that they use, whilst ok for private use, isn't good
enough for a libc function.

Additionally there were complications with the build/install-world
process. It depends heavily upon xinstall, which got broken by
the change in api, and caused bootstrap problems and general mayhem.

There is work in progress to address future problems that may be
caused by changes in install-chain tools, and better names for
{g|s}etflags can be derived when some future program requires them.
For now the code has been left in src/lib/libc/gen (it started off
in src/bin/ls).

It's important to provide library functions for manipulating file
flag strings if we ever want this interface to be adopted outside
of the source tree, but now isn't necessarily the right moment
with 4.0-release just around the corner.

Approved: jkh


# 18c0eedd 27-Jan-2000 Josef Karthauser <joe@FreeBSD.org>

Historically file flags (schg, uschg, etc) have been converted from
string to u_long and back using two functions, flags_to_string and
string_to_flags, which co-existed with 'ls'. As time has progressed
more and more other tools have used these private functions to
manipulate the file flags.

Recently I moved these functions from /usr/src/bin/ls to libutil,
but after some discussion with bde it's been decided that they
really ought to go in libc.

There are two already existing libc functions for manipulating file
modes: setmode and getmode. In keeping with these flags_to_string
has been renamed getflags and string_to_flags to setflags.

The manual page could probably be improved upon ;)


# dd562b0e 21-Nov-1999 Philippe Charnier <charnier@FreeBSD.org>

Correct use of .Nm. Add DIAGNOSTICS section. Add rcsid


# fa146c53 06-Dec-1998 Archie Cobbs <archie@FreeBSD.org>

Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]).


# 1c8af878 28-Mar-1997 Warner Losh <imp@FreeBSD.org>

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 7799f52a 30-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# 9b50d902 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Usr.bin Sources