found 754816 20140608-1
thanks

On Mon, 2014-07-14 at 17:58 +0200, Svante Signell wrote:
> Source: libewf
> Version: 20130416-3
> Severity: important
> Tags: patch
> User: [email protected]
> Usertags: hurd
> 
> Hello,
> 
> libewf fails to build from source due to usage of PATH_MAX, which is not
> defined on GNU/Hurd. The attached patch fixes usage of PATH_MAX as
> second argument to getcwd() by using calls to getcwd (NULL, 0) instead.
> Supporting (NULL, 0) as arguments is an extension to POSIX.1-2001 for
> libc4, libc5 and glibc, so most modern systems have it. In order to
> simplify the patch, only this version is implemented.
> 
> In case there is a need for a dual code path this can be fixed too, at
> the cost of additional #ifdef's in the code and a configure.ac check for
> the getcwd (NULL, 0) functionality.
> 
> libewf is flagged as out-of-date since a long time by now for Hurd and
> with the PATH_MAX fix of libbfio in bug #754792 and this patch it will
> be up-to-date again.

Attached is an updated patch for libewf. In fact it is the same as for
libbfio in #754792 with different namings.

Index: libewf-20140608/libcpath/libcpath_path.c
===================================================================
--- libewf-20140608.orig/libcpath/libcpath_path.c
+++ libewf-20140608/libcpath/libcpath_path.c
@@ -338,40 +338,12 @@ int libcpath_path_get_current_working_di
 
 		return( -1 );
 	}
-	*current_working_directory_size = (size_t) PATH_MAX;
-
-	*current_working_directory = libcstring_narrow_string_allocate(
-	                              *current_working_directory_size );
 
+	*current_working_directory = getcwd(
+					    NULL,
+					    0 );
 	if( *current_working_directory == NULL )
 	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
-		 "%s: unable to create current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( memory_set(
-	     *current_working_directory,
-	     0,
-	     sizeof( char ) * *current_working_directory_size ) == NULL )
-	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
-		 "%s: unable to clear current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( getcwd(
-	     *current_working_directory,
-	     *current_working_directory_size ) == NULL )
-	{
 		libcerror_system_set_error(
 		 error,
 		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
@@ -382,6 +354,8 @@ int libcpath_path_get_current_working_di
 
 		goto on_error;
 	}
+	*current_working_directory_size = 1 + libcstring_narrow_string_length(
+									      *current_working_directory );
 	return( 1 );
 
 on_error:
@@ -3036,23 +3010,10 @@ int libcpath_path_get_current_working_di
 
 		return( -1 );
 	}
-	narrow_current_working_directory = libcstring_narrow_string_allocate(
-	                                    PATH_MAX );
-
-	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 )
+	narrow_current_working_directory = getcwd(
+						  NULL,
+						  0 );
+	if( narrow_current_working_directory == NULL)
 	{
 		libcerror_system_set_error(
 		 error,
_______________________________________________
forensics-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/forensics-devel

Reply via email to