Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2000 11:52:10 -0800 (PST)
From:      nsayer@quack.kfu.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/22551: KDE 2.0 desktop device (cd, floppy) icons don't show mount state properly
Message-ID:  <200011021952.eA2JqAI71166@morpheus.kfu.com>

next in thread | raw e-mail | index | archive | help

>Number:         22551
>Category:       ports
>Synopsis:       KDE 2.0 desktop device (cd, floppy) icons don't show mount state properly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 02 12:00:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Nick Sayer
>Release:        FreeBSD 4.1.1-STABLE i386
>Organization:
Just me
>Environment:

kdelibs port

>Description:

KIO::findDeviceMountPoint is implemented incorrectly for FreeBSD. FreeBSD lacks a mnttab, mtab or similar file. You're supposed to do a getmntinfo() to get the list of mounted filesystems.

>How-To-Repeat:

Create an icon on your desktop for a CDROM device. Note that it is always mounted regardless of whether it is or not.

>Fix:

See also KDE bug #14146.

Add this patch to the kdelibs2 port:

--- kio/global.cpp.orig	Mon Sep 18 07:24:44 2000
+++ kio/global.cpp	Thu Nov  2 11:37:24 2000
@@ -28,6 +28,12 @@
 #include <string.h>
 #include <unistd.h>
 
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#endif
+
 #ifdef HAVE_FSTAB_H
 #include <fstab.h>
 #endif
@@ -423,6 +429,30 @@
 
     /* Get the list of mounted file systems */
 
+#ifdef __FreeBSD__
+
+    QString result;
+    struct statfs *mounted;
+
+    int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
+
+    for (int i=0;i<num_fs;i++) {
+
+      QCString device_name = mounted[i].f_mntfromname;
+
+      // If the path contains symlinks, get
+      // the real name
+      if (realpath(device_name, realpath_buffer) != 0)
+          // succes, use result from realpath
+         device_name = realpath_buffer;
+
+      if (realname == device_name) {
+        result = mounted[i].f_mntonname;
+	break;
+      }
+    }
+
+#else
     if ((mtab = SETMNTENT(MNTTAB, "r")) == 0) {
         perror("setmntent");
         return QString::null;
@@ -467,6 +497,7 @@
 
     ENDMNTENT(mtab);
     //kdDebug( 7007 ) << "Returning result " << result << endl;
+#endif
     return result;
 }
 

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011021952.eA2JqAI71166>