From 42fc3b28988488dfefc5815b8efd265dba5b125a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 12 May 2013 16:47:40 +0200 Subject: Fix halbackend does not manage to invoke 'fuser' command --- tdeioslave/media/mediamanager/halbackend.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tdeioslave/media') diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp index a9db771b9..65807b102 100644 --- a/tdeioslave/media/mediamanager/halbackend.cpp +++ b/tdeioslave/media/mediamanager/halbackend.cpp @@ -1299,10 +1299,14 @@ static TQString mount_priv(const char *udi, const char *mount_point, const char TQString HALBackend::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 += "
";
         TQTextIStream is(fuser);
@@ -1336,10 +1340,14 @@ TQString HALBackend::listUsingProcesses(const Medium* medium)
 TQString HALBackend::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 += "
";
         TQTextIStream is(fuser);
-- 
cgit v1.2.1