erik quanstrom wrote:
Are these limitations listed in some document?
I don't believe they are.
It might bve nice to think there are no arbitary limits in plan9
as the GNU mantra, however there are not many and personally,
working with remote servers with very long paths, I have never
(knowingly) hit this limit.
Having said this we could probably afford to up the size of pwd's
buffer to, say, 8k to be sixteen times as sure.
if you're going to all that trouble, why not make sure?
(i don't think this is worth it, personally, but if you do ...)
#include <u.h>
#include <libc.h>
void
main(void)
{
char *p;
int n, s;
for(s = 128; ; s <<= 1){
p = malloc(s);
if(p == nil)
sysfatal("malloc");
p[s-1] = 1;
if((getwd(p, s)) == 0)
sysfatal("pwd: %r");
if(p[s-1] == 1)
break;
}
print("%s\n", p);
exits(0);
}
- erik
AAArgg!!!1111 We leak for a fraction of micro seconds! we should
do realloc() here of course and free() the memory before exits()
just to make it even more complex ;-)
cinap