aboutsummaryrefslogtreecommitdiffstats
path: root/src/chmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chmod.c')
-rw-r--r--src/chmod.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/chmod.c b/src/chmod.c
index 477d9f9e4..3cbfe07d8 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -87,7 +87,7 @@ static bool diagnose_surprises;
static enum Verbosity verbosity = V_off;
/* Pointer to the device and inode numbers of '/', when --recursive.
- Otherwise NULL. */
+ Otherwise nullptr. */
static struct dev_ino *root_dev_ino;
/* For long options that have no equivalent short option, use a
@@ -101,17 +101,17 @@ enum
static struct option const long_options[] =
{
- {"changes", no_argument, NULL, 'c'},
- {"recursive", no_argument, NULL, 'R'},
- {"no-preserve-root", no_argument, NULL, NO_PRESERVE_ROOT},
- {"preserve-root", no_argument, NULL, PRESERVE_ROOT},
- {"quiet", no_argument, NULL, 'f'},
- {"reference", required_argument, NULL, REFERENCE_FILE_OPTION},
- {"silent", no_argument, NULL, 'f'},
- {"verbose", no_argument, NULL, 'v'},
+ {"changes", no_argument, nullptr, 'c'},
+ {"recursive", no_argument, nullptr, 'R'},
+ {"no-preserve-root", no_argument, nullptr, NO_PRESERVE_ROOT},
+ {"preserve-root", no_argument, nullptr, PRESERVE_ROOT},
+ {"quiet", no_argument, nullptr, 'f'},
+ {"reference", required_argument, nullptr, REFERENCE_FILE_OPTION},
+ {"silent", no_argument, nullptr, 'f'},
+ {"verbose", no_argument, nullptr, 'v'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
- {NULL, 0, NULL, 0}
+ {nullptr, 0, nullptr, 0}
};
/* Return true if the chmodable permission bits of FILE changed.
@@ -277,7 +277,7 @@ process_file (FTS *fts, FTSENT *ent)
{
ch.old_mode = file_stats->st_mode;
ch.new_mode = mode_adjust (ch.old_mode, S_ISDIR (ch.old_mode) != 0,
- umask_value, change, NULL);
+ umask_value, change, nullptr);
if (chmodat (fts->fts_cwd_fd, file, ch.new_mode) == 0)
ch.status = CH_SUCCEEDED;
else
@@ -303,7 +303,8 @@ process_file (FTS *fts, FTSENT *ent)
if (CH_NO_CHANGE_REQUESTED <= ch.status && diagnose_surprises)
{
mode_t naively_expected_mode =
- mode_adjust (ch.old_mode, S_ISDIR (ch.old_mode) != 0, 0, change, NULL);
+ mode_adjust (ch.old_mode, S_ISDIR (ch.old_mode) != 0,
+ 0, change, nullptr);
if (ch.new_mode & ~naively_expected_mode)
{
char new_perms[12];
@@ -326,7 +327,7 @@ process_file (FTS *fts, FTSENT *ent)
}
/* Recursively change the modes of the specified FILES (the last entry
- of which is NULL). BIT_FLAGS controls how fts works.
+ of which is null). BIT_FLAGS controls how fts works.
Return true if successful. */
static bool
@@ -334,14 +335,14 @@ process_files (char **files, int bit_flags)
{
bool ok = true;
- FTS *fts = xfts_open (files, bit_flags, NULL);
+ FTS *fts = xfts_open (files, bit_flags, nullptr);
while (true)
{
FTSENT *ent;
ent = fts_read (fts);
- if (ent == NULL)
+ if (ent == nullptr)
{
if (errno != 0)
{
@@ -416,12 +417,12 @@ Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.\n\
int
main (int argc, char **argv)
{
- char *mode = NULL;
+ char *mode = nullptr;
idx_t mode_len = 0;
idx_t mode_alloc = 0;
bool ok;
bool preserve_root = false;
- char const *reference_file = NULL;
+ char const *reference_file = nullptr;
int c;
initialize_main (&argc, &argv);
@@ -437,7 +438,7 @@ main (int argc, char **argv)
while ((c = getopt_long (argc, argv,
("Rcfvr::w::x::X::s::t::u::g::o::a::,::+::=::"
"0::1::2::3::4::5::6::7::"),
- long_options, NULL))
+ long_options, nullptr))
!= -1)
{
switch (c)
@@ -555,13 +556,13 @@ main (int argc, char **argv)
{
static struct dev_ino dev_ino_buf;
root_dev_ino = get_root_dev_ino (&dev_ino_buf);
- if (root_dev_ino == NULL)
+ if (root_dev_ino == nullptr)
die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
quoteaf ("/"));
}
else
{
- root_dev_ino = NULL;
+ root_dev_ino = nullptr;
}
ok = process_files (argv + optind,