components/gparted/patches/2.gparted-01-solaris.patch
changeset 5673 03a73b3209f6
child 6582 4fb5be1315a8
equal deleted inserted replaced
5672:4467fa93b3b7 5673:03a73b3209f6
       
     1 # Source: Internal
       
     2 # Info: This patch fixes issues introduced in updated version of GParted 0.25.0 
       
     3 # Status: This patch is Solaris specific.  Will not be sent upstream.
       
     4 --- Original/GParted_Core.cc	2016-03-08 14:38:37.669910925 -0800
       
     5 +++ gparted-0.25.0/src/GParted_Core.cc	2016-03-08 14:39:22.709951526 -0800
       
     6 @@ -49,7 +49,7 @@
       
     7  #include <sys/stat.h>
       
     8  #include <unistd.h>
       
     9  #include <dirent.h>
       
    10 -#include <mntent.h>
       
    11 +#include <sys/mnttab.h>
       
    12  #include <gtkmm/messagedialog.h>
       
    13  #include <gtkmm/main.h>
       
    14  
       
    15 @@ -1049,19 +1049,20 @@
       
    16  	const Glib::ustring & filename,
       
    17  	std::map< Glib::ustring, std::vector<Glib::ustring> > & map )
       
    18  {
       
    19 +	int i = 0;
       
    20  	FS_Info fs_info ;  //Use cache of file system information
       
    21  
       
    22 -	FILE* fp = setmntent( filename .c_str(), "r" ) ;
       
    23 +	FILE* fp = fopen( filename .c_str(), "r" ) ;
       
    24  
       
    25  	if ( fp == NULL )
       
    26  		return ;
       
    27  
       
    28 -	struct mntent* p = NULL ;
       
    29 +	struct mnttab* p = NULL ;
       
    30  
       
    31 -	while ( (p = getmntent(fp)) != NULL )
       
    32 +	while ( (i = getmntent(fp, p)) != NULL )
       
    33  	{
       
    34 -		Glib::ustring node = p->mnt_fsname ;
       
    35 -		Glib::ustring mountpoint = p->mnt_dir ;
       
    36 +		Glib::ustring node = p->mnt_fstype ;
       
    37 +		Glib::ustring mountpoint = p->mnt_mountp ;
       
    38  
       
    39  		Glib::ustring uuid = Utils::regexp_label( node, "^UUID=(.*)" ) ;
       
    40  		if ( ! uuid .empty() )
       
    41 @@ -1075,7 +1076,7 @@
       
    42  			add_node_and_mountpoint( map, node, mountpoint ) ;
       
    43  	}
       
    44  
       
    45 -	endmntent( fp ) ;
       
    46 +	fclose( fp ) ;
       
    47  }
       
    48  
       
    49  void GParted_Core::add_node_and_mountpoint(
       
    50 --- Original/Win_GParted.cc	2016-03-07 14:26:41.709974544 -0800
       
    51 +++ gparted-0.25.0/src/Win_GParted.cc	2016-03-07 14:47:13.296272589 -0800
       
    52 @@ -2175,9 +2175,14 @@
       
    53  
       
    54  	*succes = true ; 
       
    55  	for ( unsigned int t = 0 ; t < selected_partition_ptr->get_mountpoints().size() ; t++ )
       
    56 -		if ( std::count( mountpoints.begin(),
       
    57 +	{
       
    58 +		size_t n = 0;
       
    59 +
       
    60 +		std::count( mountpoints.begin(),
       
    61  		                 mountpoints.end(),
       
    62 -		                 selected_partition_ptr->get_mountpoints()[t] ) <= 1 )
       
    63 +				 selected_partition_ptr->get_mountpoints()[t],
       
    64 +				 n );
       
    65 +		if ( n <= 1 )
       
    66  		{
       
    67  			Glib::ustring cmd = "umount -v \"" + selected_partition_ptr->get_mountpoints()[t] + "\"";
       
    68  			if ( Utils::execute_command( cmd, dummy, *error ) )
       
    69 @@ -2188,6 +2193,7 @@
       
    70  		}
       
    71  		else
       
    72  			failed_mountpoints.push_back( selected_partition_ptr->get_mountpoints()[t] );
       
    73 +	}
       
    74  
       
    75  	if ( *succes && failed_mountpoints .size() )
       
    76  	{
       
    77 --- Original/main.cc	2016-03-07 15:23:50.265705094 -0800
       
    78 +++ gparted-0.25.0/src/main.cc	2016-03-07 16:24:36.544239177 -0800
       
    79 @@ -20,8 +20,16 @@
       
    80  #include <gtkmm/main.h>
       
    81  #include "../include/GParted_Core.h"
       
    82  
       
    83 +#ifdef __sun
       
    84 +char *program_name;
       
    85 +#endif
       
    86 +
       
    87  int main( int argc, char *argv[] )
       
    88  {
       
    89 +#ifdef __sun
       
    90 +	program_name = argv[0];
       
    91 +#endif
       
    92 +
       
    93  	//initialize thread system
       
    94  	Glib::thread_init() ;
       
    95  	GParted::GParted_Core::mainthread = Glib::Thread::self();
       
    96 @@ -51,7 +59,10 @@
       
    97  	}
       
    98  
       
    99  	//deal with arguments..
       
   100 -	std::vector<Glib::ustring> user_devices(argv + 1, argv + argc);
       
   101 +	std::vector<Glib::ustring> user_devices;
       
   102 +
       
   103 +	for ( int t = 1; t < argc; t++)
       
   104 +		user_devices.push_back(argv[t]);
       
   105  	
       
   106  	GParted::Win_GParted win_gparted( user_devices ) ; 
       
   107  	Gtk::Main::run( win_gparted ) ;