Dick Hollenbeck <dick@softplc.com> convert macros to inline fn's.
[fw/openocd] / src / helper / configuration.c
index 6c2bf474c93ea13b9f9e7ac4441e86c1183675f9..e33a2e1688946dd3c8ea912c95531775bfffee62 100644 (file)
@@ -2,6 +2,9 @@
  *   Copyright (C) 2004, 2005 by Dominic Rath                              *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
+ *   Copyright (C) 2007,2008 Ã˜yvind Harboe                                 *
+ *   oyvind.harboe@zylin.com                                               *
+ *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
@@ -78,7 +81,7 @@ char *find_file(const char *file)
                snprintf(full_path, 1024, "%s/%s", dir, file);
                fp = fopen(full_path, mode);
        }
-       
+
        if (fp)
        {
                fclose(fp);
@@ -88,7 +91,6 @@ char *find_file(const char *file)
        return NULL;
 }
 
-
 FILE *open_file_from_path (char *file, char *mode)
 {
        if (mode[0]!='r')
@@ -97,6 +99,8 @@ FILE *open_file_from_path (char *file, char *mode)
        } else
        {
                char *full_path=find_file(file);
+               if (full_path==NULL)
+                       return NULL;
                FILE *fp = NULL;
                fp = fopen(full_path, mode);
                free(full_path);