[gparted] Rework logic to resolve real path for symbolic link devices (#582687)
- From: Curtis Gedak <gedakc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gparted] Rework logic to resolve real path for symbolic link devices (#582687)
- Date: Wed, 14 Oct 2009 15:10:05 +0000 (UTC)
commit 5f6301d1b05bb51a7604a350dea52fb6580fdfaa
Author: Curtis Gedak <gedakc gmail com>
Date: Tue Oct 13 17:45:04 2009 -0600
Rework logic to resolve real path for symbolic link devices (#582687)
src/GParted_Core.cc | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index e07fa74..a47f7cc 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -660,19 +660,21 @@ void GParted_Core::read_mountpoints_from_file(
mountpoint = Utils::regexp_label( line, "^/[^ \t]+[ \t]+([^ \t]+)" ) ;
if ( mountpoint .length() > 0 && node .length() > 0 )
{
- //If node is a symbolic link (e.g., /dev/root), then find real path
- if ( file_test( node, Glib::FILE_TEST_IS_SYMLINK ) )
- {
- char c_str[4096+1] ;
- Glib::ustring tmp_node = node ;
- //FIXME: it seems realpath is very unsafe to use (manpage)...
- realpath( tmp_node .c_str(), c_str ) ;
- if ( tmp_node .length() > 0 )
- node = tmp_node ;
- }
- //only add this path if it exists
+ //Only add node path(s) if mount point exists
if ( file_test( mountpoint, Glib::FILE_TEST_EXISTS ) )
+ {
map[ node ] .push_back( mountpoint ) ;
+
+ //If node is a symbolic link (e.g., /dev/root)
+ // then find real path and add entry
+ if ( file_test( node, Glib::FILE_TEST_IS_SYMLINK ) )
+ {
+ char c_str[4096+1] ;
+ //FIXME: it seems realpath is very unsafe to use (manpage)...
+ if ( realpath( node .c_str(), c_str ) != NULL )
+ map[ c_str ] .push_back( mountpoint ) ;
+ }
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]