From e3aa03d6a509490e05fda8fd755519d7077714d5 Mon Sep 17 00:00:00 2001 From: Radek Brich Date: Wed, 13 Feb 2008 09:10:03 +0000 Subject: [PATCH] Related: 431879 --- tar-1.19-xattrs.patch | 23 ++++++++++++----------- tar.spec | 6 +++++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/tar-1.19-xattrs.patch b/tar-1.19-xattrs.patch index cc92d3b..3d0654c 100644 --- a/tar-1.19-xattrs.patch +++ b/tar-1.19-xattrs.patch @@ -231,6 +231,7 @@ diff -up /dev/null tar-1.17/src/xattrs.c +{ /* "system.posix_acl_access" */ +#ifdef HAVE_LIBACL + char *val = NULL; ++ size_t len; + acl_t acl; + + if (fd != -1) @@ -250,7 +251,7 @@ diff -up /dev/null tar-1.17/src/xattrs.c + } + + -+ val = acl_to_text(acl, NULL); ++ val = acl_to_text(acl, &len); + acl_free (acl); + + if (val == NULL) @@ -259,8 +260,8 @@ diff -up /dev/null tar-1.17/src/xattrs.c + return; + } + -+ *ret_ptr = xstrdup (val); -+ *ret_len = strlen (val); ++ *ret_ptr = xstrndup (val, len); ++ *ret_len = len; + + acl_free (val); +#endif @@ -272,6 +273,7 @@ diff -up /dev/null tar-1.17/src/xattrs.c +{ /* "system.posix_acl_default" */ +#ifdef HAVE_LIBACL + char *val = NULL; ++ size_t len; + acl_t acl; + + if ((acl = acl_get_file (file_name, ACL_TYPE_DEFAULT)) == (acl_t)NULL) @@ -281,7 +283,7 @@ diff -up /dev/null tar-1.17/src/xattrs.c + return; + } + -+ val = acl_to_text(acl, NULL); ++ val = acl_to_text(acl, &len); + acl_free (acl); + + if (val == NULL) @@ -290,8 +292,8 @@ diff -up /dev/null tar-1.17/src/xattrs.c + return; + } + -+ *ret_ptr = xstrdup (val); -+ *ret_len = strlen (val); ++ *ret_ptr = xstrndup (val, len); ++ *ret_len = len; + + acl_free (val); +#endif @@ -328,10 +330,10 @@ diff -up /dev/null tar-1.17/src/xattrs.c +#else + if (fd == -1) + { -+ if (lgetfilecon (file_name, &st->cntx_name) == -1) ++ if ((lgetfilecon (file_name, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA)) + call_arg_warn ("lgetfilecon", file_name); + } -+ else if (fgetfilecon (fd, &st->cntx_name) == -1) ++ else if ((fgetfilecon (fd, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA)) + call_arg_warn ("fgetfilecon", file_name); +#endif + } @@ -427,9 +429,8 @@ diff -up /dev/null tar-1.17/src/xattrs.c + ret = lsetxattr (file_name, attr, ptr, len, 0); + } + -+ if ((ret == -1) && (errno == EPERM)) -+ call_arg_warn(sysname, file_name); -+ else if ((ret == -1) && (errno != EOPNOTSUPP)) ++ /* do not print warnings when SELinux is disabled */ ++ if ((ret == -1) && (errno != EPERM) && (errno != ENOTSUP)) + call_arg_error(sysname, file_name); + } +#endif diff --git a/tar.spec b/tar.spec index 691f75d..90e57b4 100644 --- a/tar.spec +++ b/tar.spec @@ -2,7 +2,7 @@ Summary: A GNU file archiving program Name: tar Epoch: 2 Version: 1.19 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ Group: Applications/Archiving URL: http://www.gnu.org/software/tar/ @@ -90,6 +90,10 @@ fi %{_infodir}/tar.info* %changelog +* Tue Feb 12 2008 Radek Brich 2:1.19-3 +- do not print getfilecon/setfilecon warnings when SELinux is disabled + or SELinux data are not available (bz#431879) + * Mon Jan 21 2008 Radek Brich 2:1.19-2 - fix errors in man page * fix definition of --occurrence (bz#416661, patch by Jonathan Wakely)