2005-01-12 14:08:37 +00:00
|
|
|
--- groff-1.19.1/src/roff/troff/input.cpp.gzext 2005-01-12 14:17:15.469480712 +0100
|
|
|
|
+++ groff-1.19.1/src/roff/troff/input.cpp 2005-01-12 14:22:57.666458864 +0100
|
|
|
|
@@ -5590,16 +5590,20 @@ void source()
|
|
|
|
else {
|
2004-09-09 05:54:44 +00:00
|
|
|
char cbuf[PATH_MAX], * cwd;
|
|
|
|
char pbuf[PATH_MAX], * path;
|
|
|
|
+ char tmp[PATH_MAX];
|
2005-01-12 14:08:37 +00:00
|
|
|
struct stat st;
|
|
|
|
|
2004-09-09 05:54:44 +00:00
|
|
|
+ snprintf(tmp, PATH_MAX, "%s.gz", nm.contents());
|
2005-01-12 14:08:37 +00:00
|
|
|
+
|
|
|
|
while (!tok.newline() && !tok.eof())
|
|
|
|
tok.next();
|
2004-09-09 05:54:44 +00:00
|
|
|
|
|
|
|
if ((cwd = realpath(".", cbuf)) == NULL)
|
|
|
|
error("realpath on `%1' failed: %2", ".", strerror(errno));
|
|
|
|
- else if ((path = realpath(nm.contents(), pbuf)) == NULL)
|
|
|
|
- error("realpath on `%1' failed: %2", nm.contents(), strerror(errno));
|
|
|
|
- else if (safer_flag && strncmp(cwd, path, strlen(cwd)))
|
|
|
|
+ else if ((path = realpath(nm.contents(), pbuf)) == NULL &&
|
2005-01-12 14:08:37 +00:00
|
|
|
+ (path = realpath(tmp, pbuf)) == NULL) {
|
|
|
|
+ error("realpath on `%1' failed: %3", nm.contents(), strerror(errno));
|
2004-09-09 05:54:44 +00:00
|
|
|
+ } else if (safer_flag && strncmp(cwd, path, strlen(cwd)))
|
|
|
|
error("won't source `%1' outside of `%2' without -U flag", path, cwd);
|
|
|
|
else if (stat(path, &st) < 0)
|
|
|
|
error("can't stat `%1': %2", path, strerror(errno));
|