mirror of
https://gitea.psi.ch/ELOG/mxml.git
synced 2026-09-09 01:23:22 +00:00
check if absolute path when follow entity.
This commit is contained in:
parent
e5baf9cb9d
commit
ee558d0032
5
mxml.c
5
mxml.c
@ -1727,7 +1727,10 @@ int mxml_parse_entity(char **buf, char *file_name, char *error, int error_size)
|
|||||||
/* read external file */
|
/* read external file */
|
||||||
for (i = 0; i < nentity; i++) {
|
for (i = 0; i < nentity; i++) {
|
||||||
if (entity_type[i] == EXTERNAL_ENTITY) {
|
if (entity_type[i] == EXTERNAL_ENTITY) {
|
||||||
sprintf(filename, "%s%c%s", directoryname, DIR_SEPARATOR, entity_reference_name[i]);
|
if ( entity_reference_name[i][0] == DIR_SEPARATOR ) /* absolute path */
|
||||||
|
strcpy(filename, entity_reference_name[i]);
|
||||||
|
else /* relative path */
|
||||||
|
sprintf(filename, "%s%c%s", directoryname, DIR_SEPARATOR, entity_reference_name[i]);
|
||||||
fh = open(filename, O_RDONLY | O_TEXT, 0644);
|
fh = open(filename, O_RDONLY | O_TEXT, 0644);
|
||||||
|
|
||||||
if (fh == -1) {
|
if (fh == -1) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user