]>
Commit | Line | Data |
---|---|---|
1cc33159 JR |
1 | --- groff-1.18.1/src/roff/troff/input.cc.gzext 2003-02-10 18:32:00.000000000 +0100 |
2 | +++ groff-1.18.1/src/roff/troff/input.cc 2003-02-10 18:33:18.000000000 +0100 | |
3 | @@ -5487,12 +5487,16 @@ | |
4 | char cbuf[PATH_MAX], * cwd; | |
5 | char pbuf[PATH_MAX], * path; | |
6 | struct stat st; | |
7 | + char tmp[PATH_MAX]; | |
8 | + snprintf(tmp, PATH_MAX, "%s.gz", nm.contents()); | |
9 | ||
10 | if ((cwd = realpath(".", cbuf)) == NULL) | |
11 | error("realpath on `%1' failed: %2", ".", strerror(errno)); | |
12 | - else if ((path = realpath(nm.contents(), pbuf)) == NULL) | |
13 | - error("realpath on `%1' failed: %2", nm.contents(), strerror(errno)); | |
14 | - else if (safer_flag && strncmp(cwd, path, strlen(cwd))) | |
15 | + else if ((path = realpath(nm.contents(), pbuf)) == NULL && | |
16 | + (path = realpath(tmp, pbuf)) == NULL) | |
17 | + { | |
18 | + error("realpath on `%1' failed: %2", nm.contents(), strerror(errno)); | |
19 | + } else if (safer_flag && strncmp(cwd, path, strlen(cwd))) | |
20 | error("won't source `%1' outside of `%2' without -U flag", path, cwd); | |
21 | else if (stat(path, &st) < 0) | |
22 | error("can't stat `%1': %2", path, strerror(errno)); |