Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > contrib-release-src > by-pkgid > ddd8b06047a69198cf6af7bba7c2ab0d > files > 4

gparted-0.4.3-1mdv2009.1.src.rpm

--- src/GParted_Core.cc.realpath	2008-11-29 18:55:38.000000000 +0100
+++ src/GParted_Core.cc	2009-01-10 04:27:38.000000000 +0100
@@ -561,19 +561,23 @@
 		while ( getline( proc_partitions, line ) )
 			if ( sscanf( line .c_str(), "%*d %*d %*d %4096s", c_str ) == 1 )
 			{
+				char *real_path = NULL;
+
 				line = "/dev/" ; 
 				line += c_str ;
 				
 				//FIXME: it seems realpath is very unsafe to use (manpage)...
+				real_path = realpath( line .c_str(), NULL ) ;
 				if ( file_test( line, Glib::FILE_TEST_EXISTS ) &&
-				     realpath( line .c_str(), c_str ) &&
+				     real_path &&
 				     line != c_str )
 				{
 					//because we can make no assumption about which path libparted will detect
 					//we add all combinations.
 					alternate_paths[ c_str ] = line ;
-					alternate_paths[ line ] = c_str ;
 				}
+				if ( real_path )
+				  free( real_path ) ;
 			}
 
 		proc_partitions .close() ;