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