X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Ftpath.c;h=0fdf529a359882ff70e4f5d48a60525399c3138b;hp=8c339045c252adc34429175c343441ba4d0f4c54;hb=6f3861dbfb754ceffb8587c64e7631ae6ca3b650;hpb=acbea5b1df81001dc8c0e1eb75386796dde425b3 diff --git a/src/tpath.c b/src/tpath.c index 8c33904..0fdf529 100644 --- a/src/tpath.c +++ b/src/tpath.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: tpath.c,v 1.9 2006-04-27 08:39:05 adam Exp $ + * $Id: tpath.c,v 1.10 2006-06-08 10:26:10 adam Exp $ */ /** * \file tpath.c @@ -62,15 +62,17 @@ char *yaz_filepath_resolve(const char *fname, const char *path, len = path_sep - path; else len = strlen(path); + /* is path is relative and base is to be used */ if (!strchr ("/\\", *path) && base) { + /* yes: make base the first part */ strcpy (fullpath, base); slen = strlen(fullpath); fullpath[slen++] = '/'; } memcpy (fullpath+slen, path, len); slen += len; - if (!strchr("/\\", fullpath[slen-1])) + if (slen > 0 && !strchr("/\\", fullpath[slen-1])) fullpath[slen++] = '/'; } strcpy (fullpath+slen, fname);