aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/filesystems/fatresize/fatresize_parted_nix.patch
blob: e9aa87a2d564f13092e4c35d56a8761e3851f6d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
diff --git a/aclocal.m4 b/aclocal.m4
index 18e8176..2e75592 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -88,8 +88,15 @@ int main ()
 	if ( !(version = ped_get_version ()) )
 		exit(1);
 	if (sscanf(version, "%d.%d.%d", &major, &minor, &micro) != 3) {
-		printf("%s, bad version string\n", version);
-		exit(1);
+		if (sscanf(version, "%d.%d", &major, &minor) != 2)
+		{
+		  printf("%s, bad version string\n", version);
+		  exit(1);
+		}
+		else
+		{
+		  micro = 0;
+		}
 	}
 	
 	if ((major > $parted_config_major_version) ||
diff --git a/configure b/configure
index ed31457..e5f1705 100755
--- a/configure
+++ b/configure
@@ -4793,8 +4793,15 @@ int main ()
 	if ( !(version = ped_get_version ()) )
 		exit(1);
 	if (sscanf(version, "%d.%d.%d", &major, &minor, &micro) != 3) {
-		printf("%s, bad version string\n", version);
-		exit(1);
+		if (sscanf(version, "%d.%d", &major, &minor) != 2)
+		{
+		  printf("%s, bad version string\n", version);
+		  exit(1);
+		}
+		else
+		{
+		  micro = 0;
+		}
 	}
 
 	if ((major > $parted_config_major_version) ||
diff --git a/fatresize.c b/fatresize.c
index 424d5d2..e439102 100644
--- a/fatresize.c
+++ b/fatresize.c
@@ -30,6 +30,7 @@
 #include <inttypes.h>
 #include <parted/parted.h>
 #include <parted/debug.h>
+#include <parted/filesys.h>
 #include <parted/unit.h>
 
 #include "config.h"
@@ -217,7 +218,7 @@ fatresize_handler(PedException *ex)
 static int
 snap(PedSector* sector, PedSector new_sector, PedGeometry* range)
 {
-    PED_ASSERT(ped_geometry_test_sector_inside (range, *sector), return 0);
+    PED_ASSERT(ped_geometry_test_sector_inside (range, *sector));
     if (!ped_geometry_test_sector_inside(range, new_sector))
 	return 0;
 
@@ -281,7 +282,7 @@ snap_to_boundaries (PedGeometry* new_geom, PedGeometry* old_geom,
 			  end_part->geom.end, end_part->geom.start - 1, -1);
 	}
 
-	PED_ASSERT (start <= end, return);
+	PED_ASSERT (start <= end);
 	ped_geometry_set (new_geom, start, end - start + 1);
 }