inpcom.c, fix inp_pathopen(), relative path shall be expanded regarding "sourcepath"

This commit is contained in:
rlar 2013-10-31 20:58:44 +01:00
parent 7524882f67
commit 0ce23e6f10
1 changed files with 6 additions and 2 deletions

View File

@ -952,6 +952,8 @@ is_absolute_pathname(const char *p)
} }
#if 0
static bool static bool
is_plain_filename(const char *p) is_plain_filename(const char *p)
{ {
@ -965,6 +967,8 @@ is_plain_filename(const char *p)
#endif #endif
} }
#endif
/*-------------------------------------------------------------------------* /*-------------------------------------------------------------------------*
Look up the variable sourcepath and try everything in the list in order Look up the variable sourcepath and try everything in the list in order
@ -1006,10 +1010,10 @@ inp_pathopen(char *name, char *mode)
#endif #endif
/* If this is not a plain basename, or there is no sourcepath var, just /* If this is an absolute filename, or there is no sourcepath var, just
* do an fopen. * do an fopen.
*/ */
if (!is_plain_filename(name) || !cp_getvar("sourcepath", CP_LIST, &v)) if (is_absolute_pathname(name) || !cp_getvar("sourcepath", CP_LIST, &v))
return (fopen(name, mode)); return (fopen(name, mode));
for (; v; v = v->va_next) { for (; v; v = v->va_next) {