Change yaz_filepath_resolve for path="" (empty)
[yaz-moved-to-github.git] / src / tpath.c
index d4e8cbe..80dca2d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
@@ -14,7 +14,6 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/tpath.h>
 #include <yaz/log.h>
 #if HAVE_SYS_TYPES_H
@@ -75,7 +74,9 @@ size_t yaz_filepath_comp(const char **path_p, const char **comp)
 char *yaz_filepath_resolve(const char *fname, const char *path,
                            const char *base, char *fullpath)
 {
-    for(;;)
+    if (path && *path == '\0')
+        path = 0;
+    for (;;)
     {
         struct stat stat_buf;
         size_t slen = 0;
@@ -136,6 +137,7 @@ int yaz_is_abspath (const char *p)
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab