Group :: System/Configuration/Hardware
RPM: qtparted
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: qtparted-0.4.5-ide.patch
Download
Download
diff -urN qtparted-0.4.5.orig/src/qp_devlist.cpp qtparted-0.4.5/src/qp_devlist.cpp
--- qtparted-0.4.5.orig/src/qp_devlist.cpp 2005-08-10 14:05:37 +0300
+++ qtparted-0.4.5/src/qp_devlist.cpp 2007-07-23 18:34:38 +0300
@@ -239,6 +239,26 @@
devlist.clear();
}
+inline bool is_floppy(const char* d) {
+ return (d == NULL) ? FALSE : !strncmp(d, "/dev/fd", sizeof("/dev/fd")-1);
+}
+
+inline bool is_cdrom(const char* d) {
+ char s[sizeof("/proc/ide//media")+4];
+ FILE* F;
+
+ if (d == NULL) return FALSE;
+ if (!(strncmp(d, "/dev/sr", sizeof("/dev/sr")-1) && strncmp(d, "/dev/scd", sizeof("/dev/scd")-1))) return TRUE;
+ if (!strncmp(d, "/dev/hd", sizeof("/dev/hd")-1)) {
+ snprintf(s, sizeof(s), "/proc/ide%s/media", strrchr(d, '/'));
+ if (F=fopen(s, "r")) {
+ if (!strcmp(fgets(s, sizeof("cdrom"), F), "cdrom")) return TRUE;
+ fclose(F);
+ }
+ }
+ return FALSE;
+}
+
void QP_DevList::getDevices() {
/*---get all the device (ie /dev/sda, /dev/hda /etc /etc)---*/
PedDevice *dev = NULL;
@@ -247,9 +267,7 @@
while ((dev = ped_device_get_next(dev))) {
// Workaround for parted detecting CD-ROMs as harddisks
// FIXME remove if/when parted gets fixed
- QString p(dev->path);
- if(!p.startsWith("/dev/sd") && (p.contains("/dev/scd") || p.contains("/dev/sr") || access("/proc/ide/" + p.section('/', 2, 2) + "/cache", R_OK)))
- continue;
+ if (is_cdrom(dev->path) || is_floppy(dev->path)) continue;
QP_Device *device = new QP_Device(_settings);