solid hardware does not detect NFS drives, related to halectomy (#751879)

Fix fd leak in KLockFile (#753709)
This commit is contained in:
Rex Dieter 2011-11-14 09:29:23 -06:00
parent b7de02afc2
commit 504faef7f5
3 changed files with 62 additions and 113 deletions

View File

@ -1,107 +0,0 @@
Index: solid/solid/CMakeLists.txt
===================================================================
--- solid/solid/CMakeLists.txt (revision 1211253)
+++ solid/solid/CMakeLists.txt (working copy)
@@ -39,7 +39,6 @@
file(MAKE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/backends/fakehw
- ${CMAKE_CURRENT_BINARY_DIR}/backends/hal
${CMAKE_CURRENT_BINARY_DIR}/backends/udev
${CMAKE_CURRENT_BINARY_DIR}/backends/wmi
)
@@ -195,33 +194,6 @@
endif( UDEV_FOUND )
- message(STATUS "Building Solid HAL backend." )
- set(solid_LIB_SRCS ${solid_LIB_SRCS}
- backends/hal/halacadapter.cpp
- backends/hal/halaudiointerface.cpp
- backends/hal/halbattery.cpp
- backends/hal/halblock.cpp
- backends/hal/halbutton.cpp
- backends/hal/halcamera.cpp
- backends/hal/halcdrom.cpp
- backends/hal/haldeviceinterface.cpp
- backends/hal/haldvbinterface.cpp
- backends/hal/halfstabhandling.cpp
- backends/hal/halgenericinterface.cpp
- backends/hal/haldevice.cpp
- backends/hal/halmanager.cpp
- backends/hal/halnetworkinterface.cpp
- backends/hal/halserialinterface.cpp
- backends/hal/halopticaldisc.cpp
- backends/hal/halportablemediaplayer.cpp
- backends/hal/halprocessor.cpp
- backends/hal/halstorageaccess.cpp
- backends/hal/halstorage.cpp
- backends/hal/halvideo.cpp
- backends/hal/halvolume.cpp
- backends/hal/halsmartcardreader.cpp
- )
-
message(STATUS "Building Solid UPower backend." )
set(solid_LIB_SRCS ${solid_LIB_SRCS}
backends/upower/upowermanager.cpp
@@ -249,15 +221,6 @@
)
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
- message(STATUS "Building Solid fstab backend." )
- set(solid_LIB_SRCS ${solid_LIB_SRCS}
- backends/fstab/fstabmanager.cpp
- backends/fstab/fstabdevice.cpp
- backends/fstab/fstabstorageaccess.cpp
- backends/fstab/fstabhandling.cpp
- backends/fstab/fstabwatcher.cpp
- )
-
endif(NOT WIN32 AND NOT APPLE)
if(APPLE)
Index: solid/solid/managerbase.cpp
===================================================================
--- solid/solid/managerbase.cpp (revision 1211253)
+++ solid/solid/managerbase.cpp (working copy)
@@ -30,7 +30,6 @@
#if defined (Q_OS_MAC)
#include "backends/iokit/iokitmanager.h"
#elif defined (Q_OS_UNIX)
-#include "backends/hal/halmanager.h"
#include "backends/udisks/udisksmanager.h"
#include "backends/upower/upowermanager.h"
@@ -42,8 +41,6 @@
#include "backends/udev/udevmanager.h"
#endif
-#include "backends/fstab/fstabmanager.h"
-
#elif defined (Q_WS_WIN) && defined(HAVE_WBEM) && !defined(_WIN32_WCE)
#include "backends/wmi/wmimanager.h"
#endif
@@ -71,22 +68,12 @@
# elif defined(Q_WS_WIN) && defined(HAVE_WBEM) && !defined(_WIN32_WCE)
m_backends << new Solid::Backends::Wmi::WmiManager(0);
-# elif defined(Q_OS_UNIX) && !defined(Q_OS_LINUX)
- m_backends << new Solid::Backends::Hal::HalManager(0);
-
# elif defined(Q_OS_LINUX)
- bool solidHalLegacyEnabled
- = QString::fromLocal8Bit(qgetenv("SOLID_HAL_LEGACY")).toInt()==1;
- if (solidHalLegacyEnabled) {
- m_backends << new Solid::Backends::Hal::HalManager(0);
- } else {
# if defined(UDEV_FOUND)
m_backends << new Solid::Backends::UDev::UDevManager(0);
# endif
m_backends << new Solid::Backends::UDisks::UDisksManager(0)
- << new Solid::Backends::UPower::UPowerManager(0)
- << new Solid::Backends::Fstab::FstabManager(0);
- }
+ << new Solid::Backends::UPower::UPowerManager(0);
# endif
# if defined (HUPNP_FOUND)

View File

@ -0,0 +1,50 @@
commit 865e5fa4108bb3f470b9424ec34dc573d97e2473
Author: David Faure <faure@kde.org>
Date: Wed Aug 24 10:29:09 2011 +0200
Fix fd leak in KLockFile
Didn't expect that after open(fd), QFile::close doesn't close the fd :)
diff --git a/kdecore/io/klockfile_unix.cpp b/kdecore/io/klockfile_unix.cpp
index fa2eda4..93e92e2 100644
--- a/kdecore/io/klockfile_unix.cpp
+++ b/kdecore/io/klockfile_unix.cpp
@@ -78,6 +78,7 @@ public:
: staleTime(30), // 30 seconds
isLocked(false),
linkCountSupport(true),
+ mustCloseFd(false),
m_pid(-1),
m_componentData(c)
{
@@ -102,6 +103,7 @@ public:
int staleTime;
bool isLocked;
bool linkCountSupport;
+ bool mustCloseFd;
QTime staleTimer;
KDE_struct_stat statBuf;
int m_pid;
@@ -285,7 +287,10 @@ KLockFile::LockResult KLockFile::Private::lockFileOExcl(KDE_struct_stat &st_buf)
if (!m_file.open(fd, QIODevice::WriteOnly)) {
return LockError;
}
+ mustCloseFd = true;
writeIntoLockFile(m_file, m_componentData);
+
+ // stat to get the modification time
const int result = KDE_lstat(QFile::encodeName(m_fileName), &st_buf);
if (result != 0)
return KLockFile::LockError;
@@ -476,6 +481,10 @@ void KLockFile::unlock()
if (d->isLocked)
{
::unlink(QFile::encodeName(d->m_fileName));
+ if (d->mustCloseFd) {
+ close(d->m_file.handle());
+ d->mustCloseFd = false;
+ }
d->m_file.close();
d->m_pid = -1;
d->isLocked = false;

View File

@ -20,7 +20,7 @@
Summary: KDE Libraries
Version: 4.6.5
Release: 7%{?dist}
Release: 8%{?dist}
Name: kdelibs
Epoch: 6
@ -122,6 +122,10 @@ Patch103: kdelibs-4.6.5-kconfig_sync-1.patch
Patch104: kdelibs-4.6.5-kconfig_sync-2.patch
Patch105: kdelibs-4.6.5-kconfig_sync-3.patch
## 4.7 upstream
# https://projects.kde.org/projects/kde/kdelibs/repository/revisions/865e5fa4108bb3f470b9424ec34dc573d97e2473
Patch150: kdelibs-fix_fd_leak_in_klockfile.patch
## security fix
# Not Upstreamed? why not ? -- Rex
@ -131,8 +135,6 @@ Patch201: kdelibs-4.6.5-CVE-2011-3365-kio.patch
Patch202: kdelibs-4.6.5-CVE-2011-3365-kssl.patch
## Fedora specific patches
# make forcefully hal-free build
Patch300: kdelibs-4.5.90-halectomy.patch
# force upgrade of apps using the discontinued KatePart Smart* interfaces to
# versions using the new Moving* interfaces instead
@ -312,15 +314,15 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%patch104 -p1 -b .kconfig_sync-2
%patch105 -p1 -b .kconfig_sync-3
# 4.7 backported patches
%patch150 -p1 -b .fix_leak_in_klockfile
# security fix
%patch200 -p1 -b .CVE-2009-2702
%patch201 -p1 -b .CVE-2011-3365-kio
%patch202 -p1 -b .CVE-2011-3365-kssl
# Fedora patches
%if 0%{?halectomy}
%patch300 -p0 -b .halectomy
%endif
%build
@ -568,6 +570,10 @@ rm -rf %{buildroot}
%changelog
* Mon Nov 14 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.5-8
- solid hardware does not detect NFS drives, related to halectomy (#751879)
- Fix fd leak in KLockFile (#753709)
* Tue Oct 11 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.5-7
- KConfig fails to sync on VFAT, CIFS, and EncFS (#730721,kde#203554)