Package: libpff / 20120802-2

01-fix-FTBFS-hurd-386.patch Patch series | download
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
75
76
Index: libpff/libcpath/libcpath_path.c
===================================================================
--- libpff.orig/libcpath/libcpath_path.c
+++ libpff/libcpath/libcpath_path.c
@@ -342,12 +342,6 @@ int libcpath_path_get_current_working_di
 	}
 #if defined( WINAPI )
 	*current_working_directory_size = (size_t) _MAX_PATH;
-
-#else
-	*current_working_directory_size = (size_t) PATH_MAX;
-
-#endif
-
 	*current_working_directory = libcstring_narrow_string_allocate(
 	                              *current_working_directory_size );
 
@@ -362,7 +356,6 @@ int libcpath_path_get_current_working_di
 
 		goto on_error;
 	}
-#if defined( WINAPI )
 	if( _getcwd(
 	     *current_working_directory,
 	     *current_working_directory_size ) == NULL )
@@ -378,9 +371,10 @@ int libcpath_path_get_current_working_di
 		goto on_error;
 	}
 #else
-	if( getcwd(
-	     *current_working_directory,
-	     *current_working_directory_size ) == NULL )
+	*current_working_directory = getcwd(
+		 NULL,
+		 0);
+	if( *current_working_directory == NULL )
 	{
 		libcerror_system_set_error(
 		 error,
@@ -392,6 +386,8 @@ int libcpath_path_get_current_working_di
 
 		goto on_error;
 	}
+	*current_working_directory_size = 1 + libcstring_narrow_string_length(
+	                                             *current_working_directory );
 #endif
 	return( 1 );
 
@@ -3048,24 +3044,11 @@ int libcpath_path_get_current_working_di
 	*current_working_directory_size = (size_t) _MAX_PATH;
 
 #else
-	narrow_current_working_directory = libcstring_narrow_string_allocate(
-	                                    PATH_MAX );
-
+	narrow_current_working_directory = getcwd(
+		 NULL,
+		 0);
 	if( narrow_current_working_directory == NULL )
 	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
-		 "%s: unable to create narrow current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( getcwd(
-	     narrow_current_working_directory,
-	     PATH_MAX ) == NULL )
-	{
 		libcerror_system_set_error(
 		 error,
 		 LIBCERROR_ERROR_DOMAIN_RUNTIME,