3c03b3
slbt_mri_argument(): properly handle absolute path arg.
@@ -21,18 +21,25 @@ static char * slbt_mri_argument(
|
|
21
21
|
{
|
22
22
|
int i;
|
23
23
|
char * lnk;
|
24
|
+
char * target;
|
24
25
|
char mricwd[PATH_MAX];
|
25
|
-
char
|
26
|
+
char dstbuf[PATH_MAX];
|
26
27
|
|
27
28
|
if ((!(strchr(arg,'+'))) && (!(strchr(arg,'-'))))
|
28
29
|
return arg;
|
29
30
|
|
30
|
-
if
|
31
|
-
|
31
|
+
if (arg[0] == '/')
|
32
|
+
target = arg;
|
33
|
+
else {
|
34
|
+
if (!(getcwd(mricwd,sizeof(mricwd))))
|
35
|
+
return 0;
|
36
|
+
|
37
|
+
if ((size_t)snprintf(dstbuf,sizeof(dstbuf),"%s/%s",
|
38
|
+
mricwd,arg) >= sizeof(dstbuf))
|
39
|
+
return 0;
|
32
40
|
|
33
|
-
|
34
|
-
|
41
|
+
target = dstbuf;
|
42
|
+
}
|
35
|
-
return 0;
|
36
43
|
|
37
44
|
for (i=0,lnk=0; i<1024 && !lnk; i++) {
|
38
45
|
if (!(tmpnam(buf)))
|