From 134af52f38eba04b8608ab0410dae8111ea4e5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= <slavek.banko@axis.cz> Date: Sun, 12 May 2013 16:49:23 +0200 Subject: Fix tdehardwarebackend does not manage to invoke 'fuser' command --- tdeioslave/media/mediamanager/tdehardwarebackend.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tdeioslave/media/mediamanager') diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index 625b4e251..f793095fb 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -1257,10 +1257,14 @@ TQString TDEBackend::isInFstab(const Medium *medium) TQString TDEBackend::listUsingProcesses(const Medium* medium) { TQString proclist, fullmsg; - TQString cmdline = TQString("/usr/bin/env fuser -vm %1 2>&1").arg(TDEProcess::quote(medium->mountPoint())); - FILE *fuser = popen(cmdline.latin1(), "r"); + TQString fuserpath = TDEStandardDirs::findExe("fuser", TQString("/sbin:/usr/sbin:") + getenv( "PATH" )); + FILE *fuser = NULL; uint counter = 0; + if (!fuserpath.isEmpty()) { + TQString cmdline = TQString("/usr/bin/env %1 -vm %2 2>&1").arg(fuserpath, TDEProcess::quote(medium->mountPoint())); + fuser = popen(cmdline.latin1(), "r"); + } if (fuser) { proclist += "<pre>"; TQTextIStream is(fuser); @@ -1294,10 +1298,14 @@ TQString TDEBackend::listUsingProcesses(const Medium* medium) TQString TDEBackend::killUsingProcesses(const Medium* medium) { TQString proclist, fullmsg; - TQString cmdline = TQString("/usr/bin/env fuser -vmk %1 2>&1").arg(TDEProcess::quote(medium->mountPoint())); - FILE *fuser = popen(cmdline.latin1(), "r"); + TQString fuserpath = TDEStandardDirs::findExe("fuser", TQString("/sbin:/usr/sbin:") + getenv( "PATH" )); + FILE *fuser = NULL; uint counter = 0; + if (!fuserpath.isEmpty()) { + TQString cmdline = TQString("/usr/bin/env %1 -vmk %2 2>&1").arg(fuserpath, TDEProcess::quote(medium->mountPoint())); + fuser = popen(cmdline.latin1(), "r"); + } if (fuser) { proclist += "<pre>"; TQTextIStream is(fuser); -- cgit v1.2.1