10 #define _RPMDIR_INTERNAL
12 #define _RPMDAV_INTERNAL
25 static int ftpMkdir(
const char * path, mode_t mode)
30 if ((rc =
ftpCmd(
"MKD", path, NULL)) != 0)
34 sprintf(buf,
" 0%o", mode);
35 (void)
ftpCmd(
"SITE CHMOD", path, buf);
45 return ftpCmd(
"CWD", path, NULL);
52 return ftpCmd(
"RMD", path, NULL);
55 static int ftpRename(
const char * oldpath,
const char * newpath)
60 if ((rc =
ftpCmd(
"RNFR", oldpath, NULL)) != 0)
62 return ftpCmd(
"RNTO", newpath, NULL);
69 return ftpCmd(
"DELE", path, NULL);
73 int Mkdir (
const char * path, mode_t mode)
79 fprintf(stderr,
"*** Mkdir(%s, 0%o)\n", path, (
unsigned)mode);
102 return mkdir(path, mode);
108 int ut =
urlPath(path, &lpath);
111 fprintf(stderr,
"*** Chdir(%s)\n", path);
119 return davChdir(path);
144 int ut =
urlPath(path, &lpath);
147 fprintf(stderr,
"*** Rmdir(%s)\n", path);
179 int ut =
urlPath(path, &lpath);
204 if (strcmp(path,
"."))
213 fprintf(stderr,
"<-- %s(%s) prefix %s rc %d\n", __FUNCTION__, path,
_chroot_prefix, rc);
219 int Open(
const char * path,
int flags, mode_t mode)
222 int ut =
urlPath(path, &lpath);
246 size_t ob = strlen(path);
249 if (ob > nb && !strncmp(path,
_chroot_prefix, nb) && path[nb] ==
'/')
256 fdno = open(path, flags, mode);
258 if (fdno < 0 &&
errno == ENOENT) {
259 const char *dbpath =
rpmExpand(
"%{?_dbpath}/", NULL);
260 const char * fn = strstr(path + 1, dbpath);
262 fdno = open(fn, flags, mode);
263 dbpath =
_free(dbpath);
266 if (fcntl(fdno, F_SETFD, FD_CLOEXEC) < 0) {
273 #if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_RANDOM)
274 (void) posix_fadvise(fdno, 0, 0, POSIX_FADV_RANDOM);
279 fprintf(stderr,
"<-- %s(%s, 0x%x, 0%o) prefix %s fdno %d\n", __FUNCTION__, path, flags, (
unsigned)mode,
_chroot_prefix, fdno);
286 int Rename (
const char * oldpath,
const char * newpath)
288 const char *oe = NULL;
289 const char *ne = NULL;
293 fprintf(stderr,
"*** Rename(%s, %s)\n", oldpath, newpath);
295 if (!strcmp(oldpath, newpath))
return 0;
321 fprintf(stderr,
"*** rename old %*s new %*s\n", (
int)(oe - oldpath), oldpath, (
int)(ne - newpath), newpath);
322 if (!(oldut == newut && oe && ne && (oe - oldpath) == (ne - newpath) &&
342 return rename(oldpath, newpath);
345 int Link (
const char * oldpath,
const char * newpath)
347 const char *oe = NULL;
348 const char *ne = NULL;
352 fprintf(stderr,
"*** Link(%s, %s)\n", oldpath, newpath);
376 fprintf(stderr,
"*** link old %*s new %*s\n", (
int)(oe - oldpath), oldpath, (
int)(ne - newpath), newpath);
377 if (!(oldut == newut && oe && ne && (oe - oldpath) == (ne - newpath) &&
392 return link(oldpath, newpath);
399 int ut =
urlPath(path, &lpath);
428 fprintf(stderr,
"<-- %s(%s) rc %d\n", __FUNCTION__, path, rc);
434 #define g_strdup xstrdup
464 for (numcols = 0; *p && numcols <
MAXCOLS; numcols++){
465 while (*p ==
' ' || *p ==
'\r' || *p ==
'\n'){
471 while (*p && *p !=
' ' && *p !=
'\r' && *p !=
'\n')
490 if (str != NULL && strlen(str) == 8 &&
491 str[2] == str[5] && strchr(
"\\-/", (
int)str[2]) != NULL)
500 static const char * week =
"SunMonTueWedThuFriSat";
504 if (str != NULL && (pos=strstr(week, str)) != NULL) {
507 tim->tm_wday = (pos - week)/3;
517 static const char * month =
"JanFebMarAprMayJunJulAugSepOctNovDec";
521 if (str != NULL && (pos = strstr(month, str)) != NULL) {
524 tim->tm_mon = (pos - month)/3;
534 const char * p, * p2;
536 if (str != NULL && (p = strchr(str,
':')) && (p2 = strrchr(str,
':'))) {
538 if (sscanf (str,
"%2d:%2d:%2d", &tim->tm_hour, &tim->tm_min, &tim->tm_sec) != 3)
541 if (sscanf (str,
"%2d:%2d", &tim->tm_hour, &tim->tm_min) != 2)
550 static int is_year(
const char * str,
struct tm * tim)
561 if (strlen(str) != 4)
564 if (sscanf(str,
"%ld", &year) != 1)
567 if (year < 1900 || year > 3000)
570 tim->tm_year = (int) (year - 1900);
586 case 'd':
return (
int)S_IFDIR;
587 case 'b':
return (
int)S_IFBLK;
588 case 'c':
return (
int)S_IFCHR;
589 case 'l':
return (
int)S_IFLNK;
594 case 'p':
return (
int)S_IFIFO;
596 case '-':
case '?':
return (
int)S_IFREG;
606 case 'r': res |= 0400;
break;
611 case 'w': res |= 0200;
break;
616 case 'x': res |= 0100;
break;
617 case 's': res |= 0100 | S_ISUID;
break;
618 case 'S': res |= S_ISUID;
break;
623 case 'r': res |= 0040;
break;
628 case 'w': res |= 0020;
break;
633 case 'x': res |= 0010;
break;
634 case 's': res |= 0010 | S_ISGID;
break;
636 case 'S': res |= S_ISGID;
break;
641 case 'r': res |= 0004;
break;
646 case 'w': res |= 0002;
break;
651 case 'x': res |= 0001;
break;
652 case 't': res |= 0001 | S_ISVTX;
break;
653 case 'T': res |= S_ISVTX;
break;
688 tim.tm_mday = (int)atol (
columns [idx++]);
710 memset(d, 0,
sizeof(d));
711 if (sscanf(p,
"%2d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){
763 if ((*t = mktime(&tim)) < 0)
770 const char ** filename,
771 const char ** linkname)
774 int idx, idx2, num_cols;
779 if (strncmp (p,
"total", 5) == 0)
793 if (strlen (p) <= 8 || p [8] !=
']')
797 if (S_ISDIR (st->st_mode))
798 st->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IXUSR | S_IXGRP | S_IXOTH);
800 st->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR);
825 st->st_uid = finduid (
columns [1]);
830 st->st_uid = (uid_t) atol (
columns [1]);
833 for (idx = 3; idx <= 5; idx++)
837 if (idx == 6 || (idx == 5 && !S_ISCHR (st->st_mode) && !S_ISBLK (st->st_mode)))
841 if (idx == 3 || (idx == 4 && (S_ISCHR(st->st_mode) || S_ISBLK (st->st_mode))))
846 st->st_gid = (gid_t) atol (
columns [2]);
849 st->st_gid = findgid (
columns [2]);
857 if (S_ISCHR (st->st_mode) || S_ISBLK (st->st_mode)){
860 if (!
is_num (idx2) || sscanf(
columns [idx2],
" %d,", &maj) != 1)
863 if (!
is_num (++idx2) || sscanf(
columns [idx2],
" %d", &min) != 1)
867 st->st_rdev = ((maj & 0x000000ffU) << 8) | (min & 0x000000ffU);
876 st->st_size = (size_t) atol (
columns [idx2]);
886 st->st_atime = st->st_ctime = st->st_mtime;
889 #ifdef HAVE_ST_BLKSIZE
890 st->st_blksize = 512;
892 #ifdef HAVE_ST_BLOCKS
893 st->st_blocks = (st->st_size + 511) / 512;
896 for (i = idx + 1, idx2 = 0; i < num_cols; i++ )
897 if (strcmp (
columns [i],
"->") == 0){
903 (num_cols == idx + 3 && st->st_nlink > 1)))
911 t = strncpy((
char *)
xcalloc(1, nb+1), p_copy + column_ptr [idx], nb);
917 if (t [tlen-1] ==
'\r' || t [tlen-1] ==
'\n')
919 if (t [tlen-2] ==
'\r' || t [tlen-2] ==
'\n')
938 if (t [tlen-1] ==
'\r' || t [tlen-1] ==
'\n')
940 if (t [tlen-2] ==
'\r' || t [tlen-2] ==
'\n')
954 static int errorcount = 0;
956 if (++errorcount < 5) {
957 message_1s (1,
"Could not parse:", p_copy);
958 }
else if (errorcount == 5)
959 message_1s (1,
"More parsing errors will be ignored.",
"(sorry)" );
987 #define alloca_strdup(_s) strcpy((char *)alloca(strlen(_s)+1), (_s))
991 char * rlbuf,
size_t rlbufsiz)
999 int bufLength, moretodo;
1000 const char *n, *ne, *o, *oe;
1009 n = ne = o = oe = NULL;
1014 switch (ftpSysCall) {
1017 if (fd == NULL || u == NULL)
1024 if ((bn = (
char *) strrchr(urldn,
'/')) == NULL)
1026 else if (bn == path)
1037 if (fd == NULL || u == NULL)
1043 if (bn == NULL || nbn == 0) {
1051 fd =
fdLink(fd,
"error data (ftpStat)");
1073 s = se =
ftpBuf + bufLength;
1082 bufLength += strlen(se);
1086 for (s = se; *s !=
'\0'; s = se) {
1089 while (*se && *se !=
'\n') se++;
1090 if (se > s && se[-1] ==
'\r') se[-1] =
'\0';
1095 if (!strncmp(s,
"total ",
sizeof(
"total ")-1))
1099 for (bingo = 0, n = se; n >= s; n--) {
1105 if (o || !(n[-3] ==
' ' && n[-2] ==
'-' && n[-1] ==
'>')) {
1106 while (*(++n) ==
' ')
1111 for (o = n + 1; *o ==
' '; o++)
1123 if (nbn != (
size_t)(ne - n))
1125 if (strncmp(n, bn, nbn))
1132 if (moretodo && se > s) {
1133 bufLength = se - s - 1;
1135 memmove(
ftpBuf, s, bufLength);
1141 switch (ftpSysCall) {
1148 if (st == NULL || !(n && ne)) {
1155 if (rlbuf == NULL || !(o && oe)) {
1160 if (rc > (
int)rlbufsiz)
1162 memcpy(rlbuf, o, (
size_t)rc);
1163 if (rc < (
int)rlbufsiz)
1180 static const char *
statstr(
const struct stat * st,
1185 sprintf(t,
"*** dev %x", (
unsigned int)st->st_dev);
1187 sprintf(t,
" ino %x", (
unsigned int)st->st_ino);
1189 sprintf(t,
" mode %0o", (
unsigned int)st->st_mode);
1191 sprintf(t,
" nlink %d", (
unsigned int)st->st_nlink);
1193 sprintf(t,
" uid %d", (
unsigned int)st->st_uid);
1195 sprintf(t,
" gid %d", (
unsigned int)st->st_gid);
1197 sprintf(t,
" rdev %x", (
unsigned int)st->st_rdev);
1199 sprintf(t,
" size %x", (
unsigned int)st->st_size);
1206 static int ftpStat(
const char * path,
struct stat *st)
1216 if (st->st_ino == 0)
1220 fprintf(stderr,
"<-- %s(%s) rc %d\n%s", __FUNCTION__, path, rc,
statstr(st, buf));
1225 static int ftpLstat(
const char * path,
struct stat *st)
1235 if (st->st_ino == 0)
1239 fprintf(stderr,
"<-- %s(%s) rc %d\n%s\n", __FUNCTION__, path, rc,
statstr(st, buf));
1250 fprintf(stderr,
"<-- %s(%s) rc %d\n", __FUNCTION__, path, rc);
1260 struct stat * st = NULL;
1261 const char * s, * sb, * se;
1267 fprintf(stderr,
"*** ftpOpendir(%s)\n", path);
1270 avx = (rpmavx) rpmavxNew(path, st);
1283 while ((c = (
int) *se++) != (
int)
'\0') {
1290 for (sb = se; sb > s && sb[-1] !=
' '; sb--)
1295 if (*se ==
'\n') se++;
1304 avx->av = (
const char **)
xcalloc(nac+1,
sizeof(*avx->av));
1310 while ((c = (
int) *se) != (
int)
'\0') {
1318 avx->modes[nac] = (*s ==
'd' ? 0755 : 0644);
1321 case 'p': avx->modes[nac] |= S_IFIFO;
break;
1322 case 'c': avx->modes[nac] |= S_IFCHR;
break;
1323 case 'd': avx->modes[nac] |= S_IFDIR;
break;
1324 case 'b': avx->modes[nac] |= S_IFBLK;
break;
1325 case '-': avx->modes[nac] |= S_IFREG;
break;
1326 case 'l': avx->modes[nac] |= S_IFLNK;
break;
1327 case 's': avx->modes[nac] |=
S_IFSOCK;
break;
1328 default: avx->modes[nac] |= S_IFREG;
break;
1331 for (sb = se; sb > s && sb[-1] !=
' '; sb--)
1334 avx->av[nac++] = strncpy((
char *)
xcalloc(1, (se-sb-1)+1), sb, (se-sb-1));
1335 if (*se ==
'\n') se++;
1344 avdir = (AVDIR) avOpendir(path, avx->av, avx->modes);
1346 avx = rpmavxFree(avx);
1349 return (DIR *) avdir;
1356 assert(resolved_path == NULL);
1361 int Stat(
const char * path,
struct stat * st)
1366 int ut =
urlPath(path, &lpath);
1394 rc = stat(path, st);
1397 fprintf(stderr,
"<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, st, rc);
1401 int Lstat(
const char * path,
struct stat * st)
1406 int ut =
urlPath(path, &lpath);
1434 rc = lstat(path, st);
1437 fprintf(stderr,
"<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, st, rc);
1445 int ut =
urlPath(path, &lpath);
1448 if (fd == NULL || path == NULL || *path ==
'\0' || st == NULL) {
1466 memset(st, 0,
sizeof(*st));
1467 if (path[strlen(path)-1] ==
'/') {
1469 st->st_mode = (S_IFDIR | 0755);
1472 st->st_mode = (S_IFREG | 0644);
1478 st->st_atime = st->st_ctime = st->st_mtime;
1479 st->st_blksize = 4 * 1024;
1480 st->st_blocks = (st->st_size + 511)/512;
1488 rc = fstat(
Fileno(fd), st);
1491 fprintf(stderr,
"<-- %s(%p,%p) path %s rc %d\n", __FUNCTION__, fd, st, path, rc);
1499 int ut =
urlPath(path, &lpath);
1504 fprintf(stderr,
"*** %s(%p,0x%x,0x%x,0x%x) fdno %d path %s\n", __FUNCTION__, fd, (
unsigned)offset, (
unsigned)len, advice, fdno, path);
1507 if (fd == NULL || fdno < 0) {
1523 #if defined(HAVE_POSIX_FADVISE)
1524 case POSIX_FADV_NORMAL:
1525 case POSIX_FADV_SEQUENTIAL:
1526 case POSIX_FADV_RANDOM:
1527 case POSIX_FADV_NOREUSE:
1528 case POSIX_FADV_WILLNEED:
1529 case POSIX_FADV_DONTNEED:
1530 rc = posix_fadvise(fdno, offset, len, advice);
1542 __FUNCTION__, fdno, (
unsigned)offset, (
unsigned)len, rc);
1547 #undef HAVE_FALLOCATE
1552 int ut =
urlPath(path, &lpath);
1557 fprintf(stderr,
"*** %s(%p,0x%x,0x%x) fdno %d path %s\n", __FUNCTION__, fd, (
unsigned)offset, (
unsigned)len, fdno, path);
1560 if (fd == NULL || fdno < 0) {
1575 #if defined(HAVE_FALLOCATE)
1577 rc = (int) fallocate(fdno, 0, (loff_t)offset, (loff_t)len);
1578 #elif defined(HAVE_POSIX_FALLOCATE)
1579 rc = posix_fallocate(fdno, offset, len);
1586 __FUNCTION__, fdno, (
unsigned)offset, (
unsigned)len, rc);
1592 void *Mmap(
void *addr,
size_t length,
int prot,
int flags,
1593 FD_t fd, off_t offset)
1595 int fdno = (fd ?
Fileno(fd) : -1);
1596 void * ret = mmap(addr, length, prot, flags, fdno, offset);
1597 if (ret == NULL || ret == (
void *)-1)
1599 __FUNCTION__, addr, (
unsigned)len, prot, flags, fd,
1602 fprintf(stderr,
"<-- %s(%p[%u],0x%x,0x%x,%p,0x%x) ret %p\n", __FUNCTION__, addr, (
unsigned)len, prot, flags, fd, (
unsigned)offset, ret);
1606 int Munmap(
const void * addr,
size_t len)
1608 int rc = munmap(addr, len);
1611 __FUNCTION__, addr, (
unsigned)len);
1613 fprintf(stderr,
"<-- %s(%p[%u]) rc %d\n", __FUNCTION__, addr, (
unsigned)len, rc);
1617 int Mprotect(
const void * addr,
size_t len,
int prot)
1619 int rc = mprotect(addr, len, prot);
1622 __FUNCTION__, addr, (
unsigned)len, prot);
1624 fprintf(stderr,
"<-- %s(%p[%u],%d) rc %d\n", __FUNCTION__, addr, len, prot, rc);
1630 int Madvise(
void *addr,
size_t len,
int advice)
1632 int rc = madvise(addr, len, advice);
1635 __FUNCTION__, addr, (
unsigned)len, advice);
1637 fprintf(stderr,
"<-- %s(%p[%u],%d) rc %d\n", __FUNCTION__, addr, len, advice, rc);
1641 int Fadvise(
FD_t fd, off_t offset, off_t len,
int advice)
1645 int ut =
urlPath(path, &lpath);
1649 if (fd == NULL || fdno < 0) {
1663 rc = posix_fadvise(fdno, offset, len, advice);
1666 __FUNCTION__, fdno, (
unsigned)offset, (
unsigned)len, advice);
1669 fprintf(stderr,
"<-- %s(%p,0x%x,0x%x,%d) fdno %d path %s rc %d\n", __FUNCTION__, fd, (
unsigned)offset, (
unsigned)len, advice, fdno, path, rc);
1674 int Chown(
const char * path, uid_t owner, gid_t group)
1677 int ut =
urlPath(path, &lpath);
1697 rc = chown(path, owner, group);
1700 fprintf(stderr,
"<-- %s(%s,%u,%u) rc %d\n", __FUNCTION__, path, (
unsigned)owner, (
unsigned)group, rc);
1708 int ut =
urlPath(path, &lpath);
1728 rc = fchown(
Fileno(fd), owner, group);
1731 fprintf(stderr,
"<-- %s(%p,%u,%u) path %s rc %d\n", __FUNCTION__, fd, (
unsigned)owner, (
unsigned)group, path, rc);
1735 int Lchown(
const char * path, uid_t owner, gid_t group)
1738 int ut =
urlPath(path, &lpath);
1758 rc =
lchown(path, owner, group);
1761 fprintf(stderr,
"*** %s(%s,%u,%u)\n", __FUNCTION__, path, (
unsigned)owner, (
unsigned)group);
1765 int Chmod(
const char * path, mode_t mode)
1768 int ut =
urlPath(path, &lpath);
1788 rc = chmod(path, mode);
1791 fprintf(stderr,
"<-- %s(%s,%0o) rc %d\n", __FUNCTION__, path, (
int)mode, rc);
1797 #if defined(HAVE_LCHMOD)
1799 int ut =
urlPath(path, &lpath);
1819 rc = lchmod(path, mode);
1822 fprintf(stderr,
"<-- %s(%s,%0o) rc %d\n", __FUNCTION__, path, (
int)mode, rc);
1834 int ut =
urlPath(path, &lpath);
1854 rc = fchmod(
Fileno(fd), mode);
1857 fprintf(stderr,
"*** %s(%p,%0o) path %s rc %d\n", __FUNCTION__, fd, (
int)mode, path, rc);
1861 int Chflags(
const char * path,
unsigned int flags)
1863 #if defined(HAVE_CHFLAGS)
1865 int ut =
urlPath(path, &lpath);
1868 fprintf(stderr,
"*** Chflags(%s,0x%x)\n", path, flags);
1886 return chflags(path, flags);
1896 int ut =
urlPath(path, &lpath);
1899 #if defined(HAVE_LCHFLAGS)
1901 fprintf(stderr,
"*** Lchflags(%s,0x%x)\n", path, flags);
1919 return lchflags(path, flags);
1929 #if defined(HAVE_FCHFLAGS)
1932 int ut =
urlPath(path, &lpath);
1935 fprintf(stderr,
"*** Fchflags(%p,0x%x) path %s\n", fd, flags, path);
1953 return fchflags(
Fileno(fd), flags);
1962 int ut =
urlPath(path, &lpath);
1982 rc = mkfifo(path, mode);
1985 fprintf(stderr,
"<-- %s(%s,%0o) rc %d\n", __FUNCTION__, path, (
int)mode, rc);
1989 int Mknod(
const char * path, mode_t mode, dev_t dev)
1992 int ut =
urlPath(path, &lpath);
2013 rc = mknod(path, mode, dev);
2017 fprintf(stderr,
"<-- %s(%s,%0o, 0x%x) rc %d\n", __FUNCTION__, path, (
int)mode, (
int)dev, rc);
2021 int Utime(
const char * path,
const struct utimbuf *buf)
2024 int ut =
urlPath(path, &lpath);
2044 rc = utime(path, buf);
2047 fprintf(stderr,
"<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, buf, rc);
2052 int Utimes(
const char * path,
const struct timeval times[2])
2055 int ut =
urlPath(path, &lpath);
2075 rc = utimes(path, times);
2078 fprintf(stderr,
"<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, times, rc);
2084 int Lutimes(
const char * path,
const struct timeval times[2])
2088 int ut =
urlPath(path, &lpath);
2108 rc = lutimes(path, times);
2111 fprintf(stderr,
"<-- %s(%s,%p) rc %d\n", __FUNCTION__, path, times, rc);
2120 int Symlink(
const char * oldpath,
const char * newpath)
2123 int out =
urlPath(oldpath, &opath);
2125 int nut =
urlPath(newpath, &npath);
2147 rc = symlink(oldpath, newpath);
2150 fprintf(stderr,
"<-- %s(%s,%s) rc %d\n", __FUNCTION__, oldpath, newpath, rc);
2154 int Readlink(
const char * path,
char * buf,
size_t bufsiz)
2159 int ut =
urlPath(path, &lpath);
2170 rc = davReadlink(path, buf, bufsiz);
2188 rc = readlink(path, buf, bufsiz);
2192 fprintf(stderr,
"<-- %s(%s,%p[%u]) rc %d\n", __FUNCTION__, path, buf, (
unsigned)bufsiz, rc);
2199 int ut =
urlPath(path, &lpath);
2219 rc = access(path, amode);
2222 fprintf(stderr,
"<-- %s(%s,%d) rc %d\n", __FUNCTION__, path, amode, rc);
2234 int ut =
urlPath(pattern, &p);
2238 while ((c = *p++) !=
'\0')
2248 if (quote && *p !=
'\0')
2277 int Glob(
const char *pattern,
int flags,
2278 int errfunc(
const char * epath,
int eerrno),
void *_pglob)
2282 int ut =
urlPath(pattern, &lpath);
2283 const char *home =
getenv(
"HOME");
2287 fprintf(stderr,
"*** Glob(%s,0x%x,%p,%p)\n", pattern, (
unsigned)flags, (
void *)errfunc, pglob);
2296 pglob->
gl_opendir = (
void * (*)(
const char *)) Opendir;
2307 if (home && home[0])
2319 return glob(pattern, flags, errfunc, pglob);
2326 fprintf(stderr,
"*** Globfree(%p)\n", pglob);
2330 char *
Realpath(
const char * path,
char * resolved_path)
2333 int ut =
urlPath(path, &lpath);
2334 char * rpath = NULL;
2337 fprintf(stderr,
"*** Realpath(%s, %s)\n", path, (resolved_path ? resolved_path :
"NULL"));
2338 #if !defined(__LCLINT__)
2342 if (path == NULL || resolved_path != NULL)
2343 return realpath(path, resolved_path);
2365 #if defined(__linux__)
2366 lpath =
"/dev/stdin";
2377 #if !defined(__LCLINT__)
2378 if (lpath == NULL || *lpath ==
'/')
2380 rpath =
realpath(lpath, resolved_path);
2384 #if defined(__GLIBC__)
2396 if ((t =
realpath(
".", dn)) != NULL) {
2398 rpath = (
char *)
rpmGetPath(t,
"/", lpath, NULL);
2400 if (lpath[strlen(lpath)-1] ==
'/') {
2408 #if defined(__GLIBC__)
2417 off_t
Lseek(
int fdno, off_t offset,
int whence)
2420 fprintf(stderr,
"*** Lseek(%d,0x%lx,%d)\n", fdno, (
long)offset, whence);
2421 return lseek(fdno, offset, whence);