365 |
FREE(s); |
FREE(s); |
366 |
return res; |
return res; |
367 |
} |
} |
368 |
|
|
369 |
/** |
/** |
370 |
Use getenv() function to retrieve HOME path, or if not set, use |
Use getenv() function to retrieve HOME path, or if not set, use |
371 |
the password database and try to retrieve it that way (???) |
the password database and try to retrieve it that way (???) |
1257 |
char *c; |
char *c; |
1258 |
unsigned i; |
unsigned i; |
1259 |
struct FilePath **pp; |
struct FilePath **pp; |
1260 |
char path1[PATH_MAX]; |
|
1261 |
|
#if PATH_MAX < 4096 |
1262 |
|
# define SEARCHPATH_MAX 4096 |
1263 |
|
#else |
1264 |
|
# define SEARCHPATH_MAX PATH_MAX |
1265 |
|
#endif |
1266 |
|
|
1267 |
|
if(strlen(path) > SEARCHPATH_MAX){ |
1268 |
|
E("Search path is too long, increase SEARCHPATH_MAX in ospath code"); |
1269 |
|
return NULL; |
1270 |
|
} |
1271 |
|
|
1272 |
|
char path1[SEARCHPATH_MAX+1]; |
1273 |
|
|
1274 |
STRTOKVAR(nexttok); |
STRTOKVAR(nexttok); |
1275 |
|
|
1276 |
strncpy(path1,path,PATH_MAX); |
strncpy(path1,path,SEARCHPATH_MAX); |
1277 |
|
|
1278 |
X(path1); |
X(path1); |
1279 |
X(PATH_LISTSEP_STR); |
X(PATH_LISTSEP_STR); |
1292 |
X(p); |
X(p); |
1293 |
for(; p!= NULL; p=STRTOK(NULL,PATH_LISTSEP_STR,nexttok)){ |
for(; p!= NULL; p=STRTOK(NULL,PATH_LISTSEP_STR,nexttok)){ |
1294 |
c = (char *)MALLOC(sizeof(char)*(strlen(p)+1)); |
c = (char *)MALLOC(sizeof(char)*(strlen(p)+1)); |
1295 |
|
/* XXX FIXME what if one path component is longer than PATH_MAX?*/ |
1296 |
X(p); |
X(p); |
1297 |
STRCPY(c,p); |
STRCPY(c,p); |
1298 |
if(n>=LISTMAX){ |
if(n>=LISTMAX){ |