Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37518270
en ru br
ALT Linux repos
5.0: 0.4.5-alt24
4.1: 0.4.5-alt23
4.0: 0.4.5-alt20
3.0: 0.4.4-alt3.1

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


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-08-15 02:14:16 +0300
@@ -239,6 +239,28 @@
 	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[]="/sys/block/hd_/device/media";
+	FILE* F;
+
+	if (d != NULL) {
+		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)) {
+			s[13]=d[7];
+			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 +269,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_floppy(dev->path) || is_cdrom(dev->path)) continue;
 		
 		QP_Device *device = new QP_Device(_settings);
 
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin