- PPCODE:
-#ifdef HAS_GETCWD
- char * buf;
- int buflen = 128;
-
- New(0, buf, buflen, char);
- /* Many getcwd()s know how to automatically allocate memory
- * for the directory if the buffer argument is NULL but...
- * (1) we cannot assume all getcwd()s do that
- * (2) this may interfere with Perl's malloc
- * So let's not. --jhi */
- while ((getcwd(buf, buflen) == NULL) && errno == ERANGE) {
- buflen += 128;
- if (buflen > MAXPATHLEN) {
- Safefree(buf);
- buf = NULL;
- break;
- }
- Renew(buf, buflen, char);
- }
- if (buf) {
- PUSHs(sv_2mortal(newSVpv(buf, 0)));
- Safefree(buf);
- }
- else
- PUSHs(&PL_sv_undef);
+ PPCODE:
+ {
+ dXSTARG;
+ getcwd_sv(TARG);
+ XSprePUSH; PUSHTARG;
+ }
+
+SysRet
+lchown(uid, gid, path)
+ Uid_t uid
+ Gid_t gid
+ char * path
+ CODE:
+#ifdef HAS_LCHOWN
+ /* yes, the order of arguments is different,
+ * but consistent with CORE::chown() */
+ RETVAL = lchown(path, uid, gid);