rpms/sysfsutils/F-8 sysfsutils-2.1.0-get_link.patch, NONE, 1.1 sysfsutils.spec, 1.21, 1.22
Jarod Wilson (jwilson)
fedora-extras-commits at redhat.com
Tue May 20 15:05:48 UTC 2008
- Previous message (by thread): rpms/system-config-printer/devel system-config-printer-0.9.92.tar.bz2.sig, NONE, 1.1 .cvsignore, 1.168, 1.169 sources, 1.173, 1.174 system-config-printer.spec, 1.185, 1.186 system-config-printer-0.9.91.tar.bz2.sig, 1.1, NONE
- Next message (by thread): rpms/selinux-policy/F-8 modules-targeted.conf, 1.75, 1.76 policy-20070703.patch, 1.209, 1.210 selinux-policy.spec, 1.631, 1.632
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jwilson
Update of /cvs/pkgs/rpms/sysfsutils/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12651
Modified Files:
sysfsutils.spec
Added Files:
sysfsutils-2.1.0-get_link.patch
Log Message:
* Tue May 20 2008 Jarod Wilson <jwilson at redhat.com> - 2.1.0-4
- Fix up get_link on kernel 2.6.25+ (#447220)
sysfsutils-2.1.0-get_link.patch:
--- NEW FILE sysfsutils-2.1.0-get_link.patch ---
diff -upr sysfsutils-2.1.0-old/lib/sysfs_utils.c sysfsutils-2.1.0/lib/sysfs_utils.c
--- sysfsutils-2.1.0-old/lib/sysfs_utils.c 2006-08-07 07:08:01.000000000 +0200
+++ sysfsutils-2.1.0/lib/sysfs_utils.c 2008-05-13 07:42:50.000000000 +0200
@@ -117,84 +117,104 @@ int sysfs_get_link(const char *path, cha
{
char devdir[SYSFS_PATH_MAX];
char linkpath[SYSFS_PATH_MAX];
- char temp_path[SYSFS_PATH_MAX];
- char *d = NULL, *s = NULL;
- int slashes = 0, count = 0;
+ char *d, *s;
+ int count;
if (!path || !target || len == 0) {
errno = EINVAL;
return -1;
}
- memset(devdir, 0, SYSFS_PATH_MAX);
- memset(linkpath, 0, SYSFS_PATH_MAX);
- memset(temp_path, 0, SYSFS_PATH_MAX);
- safestrcpy(devdir, path);
-
- if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) {
+ count = readlink(path, linkpath, SYSFS_PATH_MAX);
+ if (count < 0)
return -1;
- }
- d = linkpath;
+ else
+ linkpath[count] = '\0';
/*
* Three cases here:
* 1. relative path => format ../..
* 2. absolute path => format /abcd/efgh
* 3. relative path _from_ this dir => format abcd/efgh
*/
- switch (*d) {
- case '.':
+ if (*linkpath == '/') {
+ /* absolute path - copy as is */
+ safestrcpymax(target, linkpath, len);
+ return 0;
+ }
+
+ safestrcpy(devdir, path);
+ s = strrchr(devdir, '/');
+ if (s == NULL)
+ s = devdir - 1;
+ d = linkpath;
+ while (*d == '.') {
+ if (*(d+1) == '/') {
/*
* handle the case where link is of type ./abcd/xxx
*/
- safestrcpy(temp_path, devdir);
- if (*(d+1) == '/')
- d += 2;
- else if (*(d+1) == '.')
- goto parse_path;
- s = strrchr(temp_path, '/');
- if (s != NULL) {
- *(s+1) = '\0';
- safestrcat(temp_path, d);
- } else {
- safestrcpy(temp_path, d);
- }
- safestrcpymax(target, temp_path, len);
- break;
+ d += 2;
+ while (*d == '/')
+ d++;
+ continue;
+ } else if (*(d+1) != '.' || *(d+2) != '/')
/*
- * relative path, getting rid of leading "../.."
+ * relative path from this directory, starting
+ * with a hidden directory
*/
-parse_path:
- while (*d == '/' || *d == '.') {
- if (*d == '/')
- slashes++;
- d++;
- }
- d--;
- s = &devdir[strlen(devdir)-1];
- while (s != NULL && count != (slashes+1)) {
+ break;
+
+ /*
+ * relative path, getting rid of leading "../.."; must
+ * be careful here since any path component of devdir
+ * could be a symlink again
+ */
+ for (;;) {
+ while (s > devdir && *s == '/') {
s--;
- if (*s == '/')
- count++;
+ if (*s == '.'
+ && (s == devdir || *(s-1) == '/'))
+ s--;
}
- safestrcpymax(s, d, (SYSFS_PATH_MAX-strlen(devdir)));
- safestrcpymax(target, devdir, len);
- break;
- case '/':
- /* absolute path - copy as is */
- safestrcpymax(target, linkpath, len);
- break;
- default:
- /* relative path from this directory */
- safestrcpy(temp_path, devdir);
- s = strrchr(temp_path, '/');
- if (s != NULL) {
- *(s+1) = '\0';
- safestrcat(temp_path, linkpath);
- } else {
- safestrcpy(temp_path, linkpath);
+ *(s+1) = '\0';
+ if (*devdir == '\0' || sysfs_path_is_link(devdir))
+ /*
+ * condition will be true eventually
+ * because we already know that all
+ * but the last component of path
+ * resolve to a directory
+ */
+ break;
+ if (sysfs_get_link(devdir, devdir, SYSFS_PATH_MAX))
+ return -1;
+ s = devdir + strlen(devdir) - 1;
+ }
+ while (s >= devdir) {
+ if (*s == '/') {
+ if (*(s+1) != '.' || *(s+2) != '.'
+ || *(s+3) != '\0') {
+ d += 3;
+ while (*d == '/')
+ d++;
+ } else
+ s += 2;
+ break;
}
- safestrcpymax(target, temp_path, len);
+ s--;
+ }
+ if (s < devdir || *(s+1) == '\0')
+ break;
}
+
+ /*
+ * appending to devdir a slash and the (possibly shortened)
+ * relative path to the link source
+ */
+ s++;
+ if (s > devdir && *s == '\0')
+ *s++ = '/';
+ *s = '\0';
+ safestrcpymax(s, d, SYSFS_PATH_MAX-(s-devdir));
+ safestrcpymax(target, devdir, len);
return 0;
}
Index: sysfsutils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/sysfsutils/F-8/sysfsutils.spec,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- sysfsutils.spec 29 Jan 2007 21:18:40 -0000 1.21
+++ sysfsutils.spec 20 May 2008 15:04:59 -0000 1.22
@@ -1,15 +1,16 @@
Name: sysfsutils
URL: http://sourceforge.net/projects/linux-diag/
-License: GPL
+License: GPLv2
Group: Development/Tools
Version: 2.1.0
-Release: 1%{?dist}
+Release: 4%{?dist}
-Summary: sysfsutils and library interface to sysfs
+Summary: Utilities for interfacing with sysfs
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source0: http://prdownloads.sourceforge.net/linux-diag/%{name}-%{version}.tar.gz
Patch0: sysfsutils-2.0.0-redhatify.patch
Patch1: sysfsutils-2.0.0-class-dup.patch
+Patch2: sysfsutils-2.1.0-get_link.patch
%description
This package's purpose is to provide a set of utilities for interfacing
@@ -18,7 +19,7 @@
%package -n libsysfs
Summary: Shared library for interfacing with sysfs
Group: System Environment/Libraries
-License: LGPL
+License: LGPLv2+
%description -n libsysfs
Library used in handling linux kernel sysfs mounts and their various files.
@@ -26,8 +27,8 @@
%package -n libsysfs-devel
Summary: Static library and headers for libsysfs
Group: Development/Libraries
+License: LGPLv2+
Requires: libsysfs = %{version}-%{release}
-Obsoletes: sysfsutils-devel
%description -n libsysfs-devel
libsysfs-devel provides the header files and static libraries required
@@ -37,6 +38,7 @@
%setup -q
%patch0 -p1 -b .redhatify
%patch1 -p1
+%patch2 -p1
%build
%configure
@@ -50,9 +52,9 @@
rm -f $RPM_BUILD_ROOT%{_bindir}/dlist_test $RPM_BUILD_ROOT%{_bindir}/get_bus_devices_list $RPM_BUILD_ROOT%{_bindir}/get_class_dev $RPM_BUILD_ROOT%{_bindir}/get_classdev_parent $RPM_BUILD_ROOT%{_bindir}/get_device $RPM_BUILD_ROOT%{_bindir}/get_driver $RPM_BUILD_ROOT%{_bindir}/testlibsysfs $RPM_BUILD_ROOT%{_bindir}/write_attr
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
-%post -p /sbin/ldconfig
+%post -n libsysfs -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
+%postun -n libsysfs -p /sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
@@ -79,6 +81,15 @@
%changelog
+* Tue May 20 2008 Jarod Wilson <jwilson at redhat.com> - 2.1.0-4
+- Fix up get_link on kernel 2.6.25+ (#447220)
+
+* Mon Feb 25 2008 Jarod Wilson <jwilson at redhat.com> - 2.1.0-3
+- Review cleanups from Todd Zullinger (#226447)
+
+* Thu Feb 14 2008 Jarod Wilson <jwilson at redhat.com> - 2.1.0-2
+- Bump and rebuild with gcc 4.3
+
* Mon Sep 29 2007 Jarod Wilson <jwilson at redhat.com> - 2.1.0-1
- Update to upstream release 2.1.0
@@ -121,7 +132,7 @@
- Rebuild
* Wed Feb 09 2005 AJ Lewis <alewis at redhat.com> 1.2.0-3
-- start using %configure instead of calling configure directly
+- start using %%configure instead of calling configure directly
* Wed Feb 09 2005 AJ Lewis <alewis at redhat.com> 1.2.0-2
- rebuild
- Previous message (by thread): rpms/system-config-printer/devel system-config-printer-0.9.92.tar.bz2.sig, NONE, 1.1 .cvsignore, 1.168, 1.169 sources, 1.173, 1.174 system-config-printer.spec, 1.185, 1.186 system-config-printer-0.9.91.tar.bz2.sig, 1.1, NONE
- Next message (by thread): rpms/selinux-policy/F-8 modules-targeted.conf, 1.75, 1.76 policy-20070703.patch, 1.209, 1.210 selinux-policy.spec, 1.631, 1.632
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list