942 |
char *wd; |
char *wd; |
943 |
SCM result; |
SCM result; |
944 |
|
|
945 |
wd = scm_must_malloc (size, FUNC_NAME); |
wd = scm_malloc (size); |
946 |
while ((rv = getcwd (wd, size)) == 0 && errno == ERANGE) |
while ((rv = getcwd (wd, size)) == 0 && errno == ERANGE) |
947 |
{ |
{ |
948 |
scm_must_free (wd); |
free (wd); |
949 |
size *= 2; |
size *= 2; |
950 |
wd = scm_must_malloc (size, FUNC_NAME); |
wd = scm_malloc (size); |
951 |
} |
} |
952 |
if (rv == 0) |
if (rv == 0) |
953 |
SCM_SYSERROR; |
SCM_SYSERROR; |
954 |
result = scm_mem2string (wd, strlen (wd)); |
result = scm_mem2string (wd, strlen (wd)); |
955 |
scm_must_free (wd); |
free (wd); |
956 |
return result; |
return result; |
957 |
} |
} |
958 |
#undef FUNC_NAME |
#undef FUNC_NAME |
1367 |
char *buf; |
char *buf; |
1368 |
SCM result; |
SCM result; |
1369 |
SCM_VALIDATE_STRING (1, path); |
SCM_VALIDATE_STRING (1, path); |
1370 |
buf = scm_must_malloc (size, FUNC_NAME); |
buf = scm_malloc (size); |
1371 |
while ((rv = readlink (SCM_STRING_CHARS (path), buf, size)) == size) |
while ((rv = readlink (SCM_STRING_CHARS (path), buf, size)) == size) |
1372 |
{ |
{ |
1373 |
scm_must_free (buf); |
free (buf); |
1374 |
size *= 2; |
size *= 2; |
1375 |
buf = scm_must_malloc (size, FUNC_NAME); |
buf = scm_malloc (size); |
1376 |
} |
} |
1377 |
if (rv == -1) |
if (rv == -1) |
1378 |
SCM_SYSERROR; |
SCM_SYSERROR; |
1379 |
result = scm_mem2string (buf, rv); |
result = scm_mem2string (buf, rv); |
1380 |
scm_must_free (buf); |
free (buf); |
1381 |
return result; |
return result; |
1382 |
} |
} |
1383 |
#undef FUNC_NAME |
#undef FUNC_NAME |