}
}
- newmode = ((S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
- & ~ umask (0));
+ newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (symbolic_mode)
{
+ newmode &= ~ umask (0);
change = mode_compile (symbolic_mode, 0);
if (change == MODE_INVALID)
error (1, 0, _("invalid mode"));
usage (1);
}
+ /* Perform an explicit chmod to ensure the file mode permission bits
+ are set as specified. This extra step is necessary in some cases
+ when the containing directory has a default ACL. */
+
+ if (symbolic_mode)
+ {
+ if (chmod (argv[optind], newmode))
+ error (0, errno, _("cannot set permissions of `%s'"),
+ quote (argv[optind]));
+ }
+
exit (0);
}