Related: 431879

This commit is contained in:
Radek Brich 2008-02-13 09:10:03 +00:00
parent e30b4cc6cd
commit e3aa03d6a5
2 changed files with 17 additions and 12 deletions

View File

@ -231,6 +231,7 @@ diff -up /dev/null tar-1.17/src/xattrs.c
+{ /* "system.posix_acl_access" */ +{ /* "system.posix_acl_access" */
+#ifdef HAVE_LIBACL +#ifdef HAVE_LIBACL
+ char *val = NULL; + char *val = NULL;
+ size_t len;
+ acl_t acl; + acl_t acl;
+ +
+ if (fd != -1) + 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); + acl_free (acl);
+ +
+ if (val == NULL) + if (val == NULL)
@ -259,8 +260,8 @@ diff -up /dev/null tar-1.17/src/xattrs.c
+ return; + return;
+ } + }
+ +
+ *ret_ptr = xstrdup (val); + *ret_ptr = xstrndup (val, len);
+ *ret_len = strlen (val); + *ret_len = len;
+ +
+ acl_free (val); + acl_free (val);
+#endif +#endif
@ -272,6 +273,7 @@ diff -up /dev/null tar-1.17/src/xattrs.c
+{ /* "system.posix_acl_default" */ +{ /* "system.posix_acl_default" */
+#ifdef HAVE_LIBACL +#ifdef HAVE_LIBACL
+ char *val = NULL; + char *val = NULL;
+ size_t len;
+ acl_t acl; + acl_t acl;
+ +
+ if ((acl = acl_get_file (file_name, ACL_TYPE_DEFAULT)) == (acl_t)NULL) + 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; + return;
+ } + }
+ +
+ val = acl_to_text(acl, NULL); + val = acl_to_text(acl, &len);
+ acl_free (acl); + acl_free (acl);
+ +
+ if (val == NULL) + if (val == NULL)
@ -290,8 +292,8 @@ diff -up /dev/null tar-1.17/src/xattrs.c
+ return; + return;
+ } + }
+ +
+ *ret_ptr = xstrdup (val); + *ret_ptr = xstrndup (val, len);
+ *ret_len = strlen (val); + *ret_len = len;
+ +
+ acl_free (val); + acl_free (val);
+#endif +#endif
@ -328,10 +330,10 @@ diff -up /dev/null tar-1.17/src/xattrs.c
+#else +#else
+ if (fd == -1) + 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); + 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); + call_arg_warn ("fgetfilecon", file_name);
+#endif +#endif
+ } + }
@ -427,9 +429,8 @@ diff -up /dev/null tar-1.17/src/xattrs.c
+ ret = lsetxattr (file_name, attr, ptr, len, 0); + ret = lsetxattr (file_name, attr, ptr, len, 0);
+ } + }
+ +
+ if ((ret == -1) && (errno == EPERM)) + /* do not print warnings when SELinux is disabled */
+ call_arg_warn(sysname, file_name); + if ((ret == -1) && (errno != EPERM) && (errno != ENOTSUP))
+ else if ((ret == -1) && (errno != EOPNOTSUPP))
+ call_arg_error(sysname, file_name); + call_arg_error(sysname, file_name);
+ } + }
+#endif +#endif

View File

@ -2,7 +2,7 @@ Summary: A GNU file archiving program
Name: tar Name: tar
Epoch: 2 Epoch: 2
Version: 1.19 Version: 1.19
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv3+ License: GPLv3+
Group: Applications/Archiving Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/ URL: http://www.gnu.org/software/tar/
@ -90,6 +90,10 @@ fi
%{_infodir}/tar.info* %{_infodir}/tar.info*
%changelog %changelog
* Tue Feb 12 2008 Radek Brich <rbrich@redhat.com> 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 <rbrich@redhat.com> 2:1.19-2 * Mon Jan 21 2008 Radek Brich <rbrich@redhat.com> 2:1.19-2
- fix errors in man page - fix errors in man page
* fix definition of --occurrence (bz#416661, patch by Jonathan Wakely) * fix definition of --occurrence (bz#416661, patch by Jonathan Wakely)