Jonathan Liu : winebuild: Don't crash when dlltool or ar can't be found.

Alexandre Julliard julliard at winehq.org
Mon Dec 16 13:02:32 CST 2013


Module: wine
Branch: master
Commit: 9c992f8a15810bf22b4604ef1e6f405ca681aa6b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9c992f8a15810bf22b4604ef1e6f405ca681aa6b

Author: Jonathan Liu <net147 at gmail.com>
Date:   Sat Dec 14 16:50:00 2013 +1100

winebuild: Don't crash when dlltool or ar can't be found.

---

 tools/winebuild/utils.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index e838165..f665e31 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -323,7 +323,7 @@ struct strarray *find_tool( const char *name, const char * const *names )
 
         /* split the path in directories */
 
-        if (!getenv( "PATH" )) return NULL;
+        if (!getenv( "PATH" )) fatal_error( "PATH not set, cannot find required tools\n" );
         path = xstrdup( getenv( "PATH" ));
         for (p = path, count = 2; *p; p++) if (*p == PATH_SEPARATOR) count++;
         dirs = xmalloc( count * sizeof(*dirs) );
@@ -374,7 +374,7 @@ struct strarray *find_tool( const char *name, const char * const *names )
         free( file );
         names++;
     }
-    return NULL;
+    fatal_error( "cannot find the '%s' tool\n", name );
 }
 
 struct strarray *get_as_command(void)
@@ -397,9 +397,6 @@ struct strarray *get_as_command(void)
         as_command = find_tool( "as", commands );
     }
 
-    if (!as_command)
-        fatal_error( "cannot find suitable assembler\n" );
-
     args = strarray_copy( as_command );
 
     if (force_pointer_size)
@@ -437,9 +434,6 @@ struct strarray *get_ld_command(void)
         ld_command = find_tool( "ld", commands );
     }
 
-    if (!ld_command)
-        fatal_error( "cannot find suitable linker\n" );
-
     args = strarray_copy( ld_command );
 
     if (force_pointer_size)
@@ -475,9 +469,6 @@ const char *get_nm_command(void)
         static const char * const commands[] = { "nm", "gnm", NULL };
         nm_command = find_tool( "nm", commands );
     }
-
-    if (!nm_command)
-        fatal_error( "cannot find suitable name lister\n" );
     if (nm_command->count > 1)
         fatal_error( "multiple arguments in nm command not supported yet\n" );
     return nm_command->str[0];




More information about the wine-cvs mailing list