/* these three calls must be done *after* fd_chown() call because fd_chown
causes that linux capabilities becomes cleared. */
- xattrs_xattrs_set (st, file_name, typeflag, 1);
+ xattrs_xattrs_set (st, file_name, typeflag, true);
xattrs_acls_set (st, file_name, typeflag);
xattrs_selinux_set (st, file_name, typeflag);
}
int r = mknodat (chdir_fd, file_name, mode, 0);
if (r < 0)
return r;
- xattrs_xattrs_set (st, file_name, typeflag, 0);
+ xattrs_xattrs_set (st, file_name, typeflag, false);
return 1;
}
#endif
attribute. Called only when acls_option > 0. */
static void
xattrs__acls_set (struct tar_stat_info const *st,
- char const *file_name, int type,
+ char const *file_name, acl_type_t type,
char *ptr, bool def)
{
acl_t acl;
val = acl_to_any_text (acl, NULL, '\n',
TEXT_SOME_EFFECTIVE | TEXT_NUMERIC_IDS);
#else
- static int warned;
+ static bool warned;
if (!warned)
{
+ warned = true;
paxwarn (0, _("--numeric-owner is ignored for ACLs:"
" libacl is not available"));
- warned = 1;
}
#endif
}
void
xattrs_acls_get (MAYBE_UNUSED int parentfd, MAYBE_UNUSED char const *file_name,
MAYBE_UNUSED struct tar_stat_info *st,
- MAYBE_UNUSED int xisfile)
+ MAYBE_UNUSED bool xisfile)
{
if (acls_option > 0)
{
#ifndef HAVE_POSIX_ACLS
- static int done = 0;
+ static bool done;
if (!done)
- paxwarn (0, _("POSIX ACL support is not available"));
- done = 1;
+ {
+ done = true;
+ paxwarn (0, _("POSIX ACL support is not available"));
+ }
#else
int err = file_has_acl_at (parentfd, file_name, &st->stat);
if (err == 0)
if (acls_option > 0 && typeflag != SYMTYPE)
{
#ifndef HAVE_POSIX_ACLS
- static int done = 0;
+ static bool done;
if (!done)
- paxwarn (0, _("POSIX ACL support is not available"));
- done = 1;
+ {
+ done = true;
+ paxwarn (0, _("POSIX ACL support is not available"));
+ }
#else
xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS,
st->acls_a_ptr, false);
if (xattrs_option)
{
#ifndef HAVE_XATTRS
- static int done = 0;
+ static bool done;
if (!done)
- paxwarn (0, _("XATTR support is not available"));
- done = 1;
+ {
+ done = true;
+ paxwarn (0, _("XATTR support is not available"));
+ }
#else
static idx_t xsz = 1024 / 2 * 3;
static char *xatrs = NULL;
if (selinux_context_option > 0)
{
#if HAVE_SELINUX_SELINUX_H != 1
- static int done = 0;
+ static bool done;
if (!done)
- paxwarn (0, _("SELinux support is not available"));
- done = 1;
+ {
+ done = true;
+ paxwarn (0, _("SELinux support is not available"));
+ }
#else
int result = (fd
? fgetfilecon (fd, &st->cntx_name)
if (selinux_context_option > 0)
{
#if HAVE_SELINUX_SELINUX_H != 1
- static int done = 0;
+ static bool done;
if (!done)
- paxwarn (0, _("SELinux support is not available"));
- done = 1;
+ {
+ done = true;
+ paxwarn (0, _("SELinux support is not available"));
+ }
#else
const char *sysname = "setfilecon";
int ret;
void
xattrs_xattrs_set (struct tar_stat_info const *st,
- char const *file_name, char typeflag, int later_run)
+ char const *file_name, char typeflag, bool later_run)
{
if (xattrs_option)
{
#ifndef HAVE_XATTRS
- static int done = 0;
+ static bool done;
if (!done)
- paxwarn (0, _("XATTR support is not available"));
- done = 1;
+ {
+ done = true;
+ paxwarn (0, _("XATTR support is not available"));
+ }
#else
if (!st->xattr_map.xm_size)
return;
extern void xattrs_mask_add (const char *mask, bool incl);
extern void xattrs_acls_get (int parentfd, char const *file_name,
- struct tar_stat_info *st, int xisfile);
+ struct tar_stat_info *st, bool xisfile);
extern void xattrs_selinux_get (int parentfd, char const *file_name,
struct tar_stat_info *st, int fd);
extern void xattrs_xattrs_get (int parentfd, char const *file_name,
char const *file_name, char typeflag);
extern void xattrs_xattrs_set (struct tar_stat_info const *st,
char const *file_name, char typeflag,
- int later_run);
+ bool later_run);
extern void xattrs_print_char (struct tar_stat_info const *st, char *output);
extern void xattrs_print (struct tar_stat_info const *st);