lib/rpmio.c: Implement per-fd layers as a stack, add fdPush/fdPop.
lib/rpmio.c: Add fd{Get,Set}{Io,Fp,Fdno} abstraction wrappers. lib/rpmio.c: Start rationalizing debug output by using fdbg to display the fd layer stack. rpm.c: Add --nolibio to disable libio if desired. rpm2cpio.c: Use Fdopen(..., gzdio) and ufdCopy(). build/build.c: Use Fdopen(..., fpio) rather than fdio. build/files.c: Use Fdopen(..., fpio) rather than ufdio. build/parseSpec.c: ditto. lib/macro.c: ditto. lib/rpmrc.c: ditto lib/macro.c: Use Fopen(..., ufdio) in isCompressed() rather that fdOpen(). lib/misc.c: ditto. lib/misc.c: Avoid fstat by using Stat. build/pack.c: Add persist fdLink() and use fdFree() in package{Sources,Binaries} build/pack.c: Try to remove the fdDup before cpioBuildArchive() call. build/pack.c: Use rpmGenPath with %{_builddir}. build/parsePreamble.c: Use fdSize rather than Stat to get icon file size. lib/rpmrc.c: ditto lib/ftp.c: start capturing ufdio layer syserrno/errcookie. CVS patchset: 3424 CVS date: 1999/11/14 19:15:18
This commit is contained in:
parent
471ba3b238
commit
4e62a322a2
|
@ -87,8 +87,12 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
|
||||||
#ifdef HAVE_FCHMOD
|
#ifdef HAVE_FCHMOD
|
||||||
(void)fchmod(Fileno(fd), 0600); /* XXX fubar on ufdio */
|
(void)fchmod(Fileno(fd), 0600); /* XXX fubar on ufdio */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DYING
|
||||||
/* XXX FIXME: build/build.c Fdopen assertion failure, makeTempFile uses fdio */
|
/* XXX FIXME: build/build.c Fdopen assertion failure, makeTempFile uses fdio */
|
||||||
xfd = Fdopen(fd, "w.fdio");
|
xfd = Fdopen(fd, "w.fdio");
|
||||||
|
#else
|
||||||
|
xfd = Fdopen(fd, "w.fpio");
|
||||||
|
#endif
|
||||||
|
|
||||||
strcpy(buf, _preScriptEnvironment);
|
strcpy(buf, _preScriptEnvironment);
|
||||||
expandMacros(spec, spec->macros, buf, sizeof(buf));
|
expandMacros(spec, spec->macros, buf, sizeof(buf));
|
||||||
|
|
|
@ -1176,7 +1176,7 @@ static int processPackageFiles(Spec spec, Package pkg,
|
||||||
ffn = rpmGetPath("%{_builddir}/",
|
ffn = rpmGetPath("%{_builddir}/",
|
||||||
(spec->buildSubdir ? spec->buildSubdir : "") ,
|
(spec->buildSubdir ? spec->buildSubdir : "") ,
|
||||||
"/", pkg->fileFile, NULL);
|
"/", pkg->fileFile, NULL);
|
||||||
fd = Fopen(ffn, "r.ufdio");
|
fd = Fopen(ffn, "r.fpio");
|
||||||
xfree(ffn);
|
xfree(ffn);
|
||||||
|
|
||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
|
|
41
build/pack.c
41
build/pack.c
|
@ -59,13 +59,14 @@ int packageSources(Spec spec)
|
||||||
|
|
||||||
memset(csa, 0, sizeof(*csa));
|
memset(csa, 0, sizeof(*csa));
|
||||||
csa->cpioArchiveSize = 0;
|
csa->cpioArchiveSize = 0;
|
||||||
csa->cpioFdIn = fdNew(fdio, "init (packageSources)");
|
csa->cpioFdIn = fdNew("init (packageSources)");
|
||||||
|
csa->cpioFdIn = fdLink(csa->cpioFdIn, "persist (packageSources)");
|
||||||
csa->cpioList = spec->sourceCpioList;
|
csa->cpioList = spec->sourceCpioList;
|
||||||
csa->cpioCount = spec->sourceCpioCount;
|
csa->cpioCount = spec->sourceCpioCount;
|
||||||
|
|
||||||
rc = writeRPM(spec->sourceHeader, fn, RPMLEAD_SOURCE,
|
rc = writeRPM(spec->sourceHeader, fn, RPMLEAD_SOURCE,
|
||||||
csa, spec->passPhrase, &(spec->cookie));
|
csa, spec->passPhrase, &(spec->cookie));
|
||||||
free(csa->cpioFdIn);
|
csa->cpioFdIn = fdFree(csa->cpioFdIn, "persist (packageSources)");
|
||||||
xfree(fn);
|
xfree(fn);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -156,13 +157,14 @@ int packageBinaries(Spec spec)
|
||||||
|
|
||||||
memset(csa, 0, sizeof(*csa));
|
memset(csa, 0, sizeof(*csa));
|
||||||
csa->cpioArchiveSize = 0;
|
csa->cpioArchiveSize = 0;
|
||||||
csa->cpioFdIn = fdNew(fdio, "init (packageBinaries)");
|
csa->cpioFdIn = fdNew("init (packageBinaries)");
|
||||||
|
csa->cpioFdIn = fdLink(csa->cpioFdIn, "persist (packageBinaries)");
|
||||||
csa->cpioList = pkg->cpioList;
|
csa->cpioList = pkg->cpioList;
|
||||||
csa->cpioCount = pkg->cpioCount;
|
csa->cpioCount = pkg->cpioCount;
|
||||||
|
|
||||||
rc = writeRPM(pkg->header, fn, RPMLEAD_BINARY,
|
rc = writeRPM(pkg->header, fn, RPMLEAD_BINARY,
|
||||||
csa, spec->passPhrase, NULL);
|
csa, spec->passPhrase, NULL);
|
||||||
free(csa->cpioFdIn);
|
csa->cpioFdIn = fdFree(csa->cpioFdIn, "persist (packageBinaries)");
|
||||||
xfree(fn);
|
xfree(fn);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -245,6 +247,9 @@ int writeRPM(Header h, const char *fileName, int type,
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
Header sig;
|
Header sig;
|
||||||
struct rpmlead lead;
|
struct rpmlead lead;
|
||||||
|
#ifdef DYING
|
||||||
|
int fdno;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Fileno(csa->cpioFdIn) < 0) {
|
if (Fileno(csa->cpioFdIn) < 0) {
|
||||||
csa->cpioArchiveSize = 0;
|
csa->cpioArchiveSize = 0;
|
||||||
|
@ -267,6 +272,12 @@ int writeRPM(Header h, const char *fileName, int type,
|
||||||
rpmError(RPMERR_CREATE, _("Unable to open temp file"));
|
rpmError(RPMERR_CREATE, _("Unable to open temp file"));
|
||||||
return RPMERR_CREATE;
|
return RPMERR_CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DYING
|
||||||
|
fd = fdLink(fd, "persist"); /* XXX keep fd from being freed */
|
||||||
|
fdno = Fileno(fd); /* XXX HACK HACK HACK to keep fdno open */
|
||||||
|
#endif
|
||||||
|
|
||||||
if (headerWrite(fd, h, HEADER_MAGIC_YES)) {
|
if (headerWrite(fd, h, HEADER_MAGIC_YES)) {
|
||||||
rc = RPMERR_NOSPACE;
|
rc = RPMERR_NOSPACE;
|
||||||
} else { /* Write the archive and get the size */
|
} else { /* Write the archive and get the size */
|
||||||
|
@ -279,6 +290,11 @@ int writeRPM(Header h, const char *fileName, int type,
|
||||||
rc = RPMERR_BADARG;
|
rc = RPMERR_BADARG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DYING
|
||||||
|
fdSetFdno(fd, fdno); /* XXX HACK HACK HACK to keep fdno open */
|
||||||
|
#endif
|
||||||
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
Fclose(fd);
|
Fclose(fd);
|
||||||
unlink(sigtarget);
|
unlink(sigtarget);
|
||||||
|
@ -419,7 +435,11 @@ static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmode)
|
||||||
int rc;
|
int rc;
|
||||||
const char *failedFile = NULL;
|
const char *failedFile = NULL;
|
||||||
|
|
||||||
|
#ifndef DYING
|
||||||
cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
|
cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
|
||||||
|
#else
|
||||||
|
cfd = Fdopen(fdo, fmode);
|
||||||
|
#endif
|
||||||
rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
|
rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
|
||||||
&csa->cpioArchiveSize, &failedFile);
|
&csa->cpioArchiveSize, &failedFile);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
@ -438,7 +458,7 @@ static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmode)
|
||||||
static int cpio_copy(FD_t fdo, CSA_t *csa)
|
static int cpio_copy(FD_t fdo, CSA_t *csa)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
ssize_t nb;
|
size_t nb;
|
||||||
|
|
||||||
while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) {
|
while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) {
|
||||||
if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) {
|
if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) {
|
||||||
|
@ -448,7 +468,7 @@ static int cpio_copy(FD_t fdo, CSA_t *csa)
|
||||||
}
|
}
|
||||||
csa->cpioArchiveSize += nb;
|
csa->cpioArchiveSize += nb;
|
||||||
}
|
}
|
||||||
if (nb < 0) {
|
if (Ferror(csa->cpioFdIn)) {
|
||||||
rpmError(RPMERR_CPIO, _("cpio_copy read failed: %s"),
|
rpmError(RPMERR_CPIO, _("cpio_copy read failed: %s"),
|
||||||
Fstrerror(csa->cpioFdIn));
|
Fstrerror(csa->cpioFdIn));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -462,15 +482,8 @@ static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb)
|
||||||
const char *fn = buf;
|
const char *fn = buf;
|
||||||
FD_t fd;
|
FD_t fd;
|
||||||
|
|
||||||
#ifdef DYING
|
/* XXX use rpmGenPath(rootdir, "%{_buildir}/%{_buildsubdir}/", file) */
|
||||||
strcpy(fn, "%{_builddir}/");
|
|
||||||
expandMacros(spec, spec->macros, fn, sizeof(fn));
|
|
||||||
strcat(fn, spec->buildSubdir);
|
|
||||||
strcat(fn, "/");
|
|
||||||
strcat(fn, file);
|
|
||||||
#else
|
|
||||||
fn = rpmGetPath("%{_builddir}/", spec->buildSubdir, "/", file, NULL);
|
fn = rpmGetPath("%{_builddir}/", spec->buildSubdir, "/", file, NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
fd = Fopen(fn, "r.ufdio");
|
fd = Fopen(fn, "r.ufdio");
|
||||||
if (fn != buf) xfree(fn);
|
if (fn != buf) xfree(fn);
|
||||||
|
|
|
@ -229,22 +229,24 @@ static int readIcon(Header h, const char *file)
|
||||||
{
|
{
|
||||||
const char *fn = NULL;
|
const char *fn = NULL;
|
||||||
char *icon;
|
char *icon;
|
||||||
|
#ifdef DYING
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
#endif
|
||||||
FD_t fd;
|
FD_t fd;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int nb;
|
off_t size;
|
||||||
|
size_t nb, iconsize;
|
||||||
|
|
||||||
/* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
|
/* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
|
||||||
fn = rpmGetPath("%{_sourcedir}/", file, NULL);
|
fn = rpmGetPath("%{_sourcedir}/", file, NULL);
|
||||||
|
|
||||||
|
#ifdef DYING
|
||||||
if (Stat(fn, &statbuf)) {
|
if (Stat(fn, &statbuf)) {
|
||||||
rpmError(RPMERR_BADSPEC, _("Unable to stat icon: %s"), fn);
|
rpmError(RPMERR_BADSPEC, _("Unable to stat icon: %s"), fn);
|
||||||
rc = RPMERR_BADSPEC;
|
rc = RPMERR_BADSPEC;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
icon = xmalloc(statbuf.st_size);
|
|
||||||
*icon = '\0';
|
|
||||||
|
|
||||||
fd = Fopen(fn, "r.ufdio");
|
fd = Fopen(fn, "r.ufdio");
|
||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
|
@ -253,8 +255,19 @@ static int readIcon(Header h, const char *file)
|
||||||
rc = RPMERR_BADSPEC;
|
rc = RPMERR_BADSPEC;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
nb = Fread(icon, sizeof(char), statbuf.st_size, fd);
|
size = fdSize(fd);
|
||||||
if (nb != statbuf.st_size) {
|
iconsize = (size >= 0 ? size : (8 * BUFSIZ));
|
||||||
|
if (iconsize == 0) {
|
||||||
|
Fclose(fd);
|
||||||
|
rc = 0;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
icon = xmalloc(iconsize + 1);
|
||||||
|
*icon = '\0';
|
||||||
|
|
||||||
|
nb = Fread(icon, sizeof(char), iconsize, fd);
|
||||||
|
if (Ferror(fd) || (size >= 0 && nb != size)) {
|
||||||
rpmError(RPMERR_BADSPEC, _("Unable to read icon %s: %s"),
|
rpmError(RPMERR_BADSPEC, _("Unable to read icon %s: %s"),
|
||||||
fn, Fstrerror(fd));
|
fn, Fstrerror(fd));
|
||||||
rc = RPMERR_BADSPEC;
|
rc = RPMERR_BADSPEC;
|
||||||
|
@ -264,9 +277,9 @@ static int readIcon(Header h, const char *file)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (! strncmp(icon, "GIF", sizeof("GIF")-1)) {
|
if (! strncmp(icon, "GIF", sizeof("GIF")-1)) {
|
||||||
headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, statbuf.st_size);
|
headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, iconsize);
|
||||||
} else if (! strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) {
|
} else if (! strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) {
|
||||||
headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, statbuf.st_size);
|
headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize);
|
||||||
} else {
|
} else {
|
||||||
rpmError(RPMERR_BADSPEC, _("Unknown icon type: %s"), file);
|
rpmError(RPMERR_BADSPEC, _("Unknown icon type: %s"), file);
|
||||||
rc = RPMERR_BADSPEC;
|
rc = RPMERR_BADSPEC;
|
||||||
|
|
|
@ -169,10 +169,10 @@ int readLine(Spec spec, int strip)
|
||||||
retry:
|
retry:
|
||||||
/* Make sure the current file is open */
|
/* Make sure the current file is open */
|
||||||
if (ofi->fd == NULL) {
|
if (ofi->fd == NULL) {
|
||||||
if ((ofi->fd = Fopen(ofi->fileName, "r.ufdio")) == NULL) {
|
if ((ofi->fd = Fopen(ofi->fileName, "r.fpio")) == NULL) {
|
||||||
/* XXX Fstrerror */
|
/* XXX Fstrerror */
|
||||||
rpmError(RPMERR_BADSPEC, _("Unable to open: %s\n"),
|
rpmError(RPMERR_BADSPEC, _("Unable to open %s: %s\n"),
|
||||||
ofi->fileName);
|
ofi->fileName, Fstrerror(ofi->fd));
|
||||||
return RPMERR_BADSPEC;
|
return RPMERR_BADSPEC;
|
||||||
}
|
}
|
||||||
spec->lineNum = ofi->lineNum = 0;
|
spec->lineNum = ofi->lineNum = 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@ FD_t fadOpen(const char * path, int flags, int perms)
|
||||||
/* XXX Fstrerror */
|
/* XXX Fstrerror */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
fdSetIoCookie(fd, fadio);
|
fdSetIo(fd, fadio);
|
||||||
fadSetFirstFree(fd, 0);
|
fadSetFirstFree(fd, 0);
|
||||||
fadSetFileSize(fd, Fseek(fd, 0, SEEK_END));
|
fadSetFileSize(fd, Fseek(fd, 0, SEEK_END));
|
||||||
|
|
||||||
|
|
33
lib/ftp.c
33
lib/ftp.c
|
@ -304,7 +304,7 @@ static int getHostAddress(const char * host, struct in_addr * address)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tcpConnect(const char *host, int port)
|
static int tcpConnect(FD_t ctrl, const char *host, int port)
|
||||||
{
|
{
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
int fdno = -1;
|
int fdno = -1;
|
||||||
|
@ -339,6 +339,7 @@ static int tcpConnect(const char *host, int port)
|
||||||
return fdno;
|
return fdno;
|
||||||
|
|
||||||
errxit:
|
errxit:
|
||||||
|
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
|
||||||
if (fdno >= 0)
|
if (fdno >= 0)
|
||||||
close(fdno);
|
close(fdno);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -364,14 +365,17 @@ int httpOpen(urlinfo u, FD_t ctrl, const char *httpcmd)
|
||||||
path = (u->proxyh || u->proxyp > 0) ? u->url : u->path;
|
path = (u->proxyh || u->proxyp > 0) ? u->url : u->path;
|
||||||
|
|
||||||
reopen:
|
reopen:
|
||||||
if (fdio->fileno(ctrl) >= 0 && fdWritable(ctrl, 0) < 1)
|
if (fdio->fileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
|
||||||
|
if (_ftp_debug)
|
||||||
|
fprintf(stderr, "*** httpOpen closing ctrl fdno %d rc %d\n", fdio->fileno(ctrl), rc);
|
||||||
fdio->close(ctrl);
|
fdio->close(ctrl);
|
||||||
|
}
|
||||||
|
|
||||||
if (fdio->fileno(ctrl) < 0) {
|
if (fdio->fileno(ctrl) < 0) {
|
||||||
rc = tcpConnect(host, port);
|
rc = tcpConnect(ctrl, host, port);
|
||||||
fdSetFdno(ctrl, (rc >= 0 ? rc : -1));
|
fdSetFdno(ctrl, (rc >= 0 ? rc : -1));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto errxit;
|
goto errxit2;
|
||||||
|
|
||||||
ctrl = fdLink(ctrl, "open ctrl (httpOpen)");
|
ctrl = fdLink(ctrl, "open ctrl (httpOpen)");
|
||||||
}
|
}
|
||||||
|
@ -431,6 +435,8 @@ fprintf(stderr, "*** httpOpen ctrl %p reopening ...\n", ctrl);
|
||||||
return fdio->fileno(ctrl);
|
return fdio->fileno(ctrl);
|
||||||
|
|
||||||
errxit:
|
errxit:
|
||||||
|
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
|
||||||
|
errxit2:
|
||||||
if (fdio->fileno(ctrl) >= 0)
|
if (fdio->fileno(ctrl) >= 0)
|
||||||
fdio->close(ctrl);
|
fdio->close(ctrl);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -445,8 +451,10 @@ int ftpOpen(urlinfo u)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
URLSANE(u);
|
URLSANE(u);
|
||||||
if (((host = (u->proxyh ? u->proxyh : u->host)) == NULL))
|
if (((host = (u->proxyh ? u->proxyh : u->host)) == NULL)) {
|
||||||
return FTPERR_BAD_HOSTNAME;
|
rc = FTPERR_BAD_HOSTNAME;
|
||||||
|
goto errxit;
|
||||||
|
}
|
||||||
|
|
||||||
if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = IPPORT_FTP;
|
if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = IPPORT_FTP;
|
||||||
|
|
||||||
|
@ -469,10 +477,10 @@ int ftpOpen(urlinfo u)
|
||||||
fdio->close(u->ctrl);
|
fdio->close(u->ctrl);
|
||||||
|
|
||||||
if (fdio->fileno(u->ctrl) < 0) {
|
if (fdio->fileno(u->ctrl) < 0) {
|
||||||
rc = tcpConnect(host, port);
|
rc = tcpConnect(u->ctrl, host, port);
|
||||||
fdSetFdno(u->ctrl, (rc >= 0 ? rc : -1));
|
fdSetFdno(u->ctrl, (rc >= 0 ? rc : -1));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto errxit;
|
goto errxit2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = ftpCheckResponse(u, NULL)))
|
if ((rc = ftpCheckResponse(u, NULL)))
|
||||||
|
@ -491,6 +499,8 @@ int ftpOpen(urlinfo u)
|
||||||
return fdio->fileno(u->ctrl);
|
return fdio->fileno(u->ctrl);
|
||||||
|
|
||||||
errxit:
|
errxit:
|
||||||
|
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
|
||||||
|
errxit2:
|
||||||
if (fdio->fileno(u->ctrl) >= 0)
|
if (fdio->fileno(u->ctrl) >= 0)
|
||||||
fdio->close(u->ctrl);
|
fdio->close(u->ctrl);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -625,20 +635,17 @@ int ftpFileDesc(urlinfo u, const char *cmd, FD_t data)
|
||||||
sizeof(dataAddress)) < 0) {
|
sizeof(dataAddress)) < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
fdio->close(data);
|
|
||||||
rc = FTPERR_FAILED_DATA_CONNECT;
|
rc = FTPERR_FAILED_DATA_CONNECT;
|
||||||
goto errxit;
|
goto errxit;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG(0, (stderr, "-> %s", cmd));
|
DBG(0, (stderr, "-> %s", cmd));
|
||||||
if (fdio->write(u->ctrl, cmd, cmdlen) != cmdlen) {
|
if (fdio->write(u->ctrl, cmd, cmdlen) != cmdlen) {
|
||||||
fdio->close(data);
|
|
||||||
rc = FTPERR_SERVER_IO_ERROR;
|
rc = FTPERR_SERVER_IO_ERROR;
|
||||||
goto errxit;
|
goto errxit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = ftpCheckResponse(u, NULL))) {
|
if ((rc = ftpCheckResponse(u, NULL))) {
|
||||||
fdio->close(data);
|
|
||||||
goto errxit;
|
goto errxit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,5 +655,9 @@ int ftpFileDesc(urlinfo u, const char *cmd, FD_t data)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
errxit:
|
errxit:
|
||||||
|
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
|
||||||
|
errxit2:
|
||||||
|
if (fdio->fileno(data) >= 0)
|
||||||
|
fdio->close(data);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ static int installArchive(FD_t fd, struct fileInfo * files,
|
||||||
(void)notify(h, RPMCALLBACK_INST_PROGRESS, 0, archiveSize, pkgKey,
|
(void)notify(h, RPMCALLBACK_INST_PROGRESS, 0, archiveSize, pkgKey,
|
||||||
notifyData);
|
notifyData);
|
||||||
|
|
||||||
cfd = Fdopen(fdDup(Fileno(fd)), "r.gzdio");
|
cfd = Fdopen(fd, "r.gzdio");
|
||||||
rc = cpioInstallArchive(cfd, map, mappedFiles,
|
rc = cpioInstallArchive(cfd, map, mappedFiles,
|
||||||
((notify && archiveSize) || specFile) ? callback : NULL,
|
((notify && archiveSize) || specFile) ? callback : NULL,
|
||||||
&info, &failedFile);
|
&info, &failedFile);
|
||||||
|
|
|
@ -1300,7 +1300,7 @@ initMacros(MacroContext *mc, const char *macrofiles)
|
||||||
strncat(buf, mfile, sizeof(buf) - strlen(buf));
|
strncat(buf, mfile, sizeof(buf) - strlen(buf));
|
||||||
buf[sizeof(buf)-1] = '\0';
|
buf[sizeof(buf)-1] = '\0';
|
||||||
|
|
||||||
fd = Fopen(buf, "r.ufdio");
|
fd = Fopen(buf, "r.fpio");
|
||||||
if (fd == NULL || Ferror(fd))
|
if (fd == NULL || Ferror(fd))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1357,11 +1357,7 @@ int isCompressed(const char *file, int *compressed)
|
||||||
|
|
||||||
*compressed = COMPRESSED_NOT;
|
*compressed = COMPRESSED_NOT;
|
||||||
|
|
||||||
#ifdef DYING
|
|
||||||
fd = fdOpen(file, O_RDONLY, 0);
|
|
||||||
#else
|
|
||||||
fd = Fopen(file, "r.ufdio");
|
fd = Fopen(file, "r.ufdio");
|
||||||
#endif
|
|
||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
/* XXX Fstrerror */
|
/* XXX Fstrerror */
|
||||||
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, Fstrerror(fd));
|
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, Fstrerror(fd));
|
||||||
|
|
16
lib/misc.c
16
lib/misc.c
|
@ -404,7 +404,7 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX FIXME: build/build.c Fdopen assertion failure, makeTempFile uses fdio */
|
/* XXX FIXME: build/build.c Fdopen assertion failure, makeTempFile uses fdio */
|
||||||
#ifndef NOTYET
|
#ifdef DYING
|
||||||
fd = fdio->open(tfn, (O_CREAT|O_RDWR|O_EXCL), 0700);
|
fd = fdio->open(tfn, (O_CREAT|O_RDWR|O_EXCL), 0700);
|
||||||
#else
|
#else
|
||||||
fd = Fopen(tfn, "w+x.ufdio");
|
fd = Fopen(tfn, "w+x.ufdio");
|
||||||
|
@ -424,14 +424,16 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NOTYET
|
#ifndef NOTYET
|
||||||
fstat(Fileno(fd), &sb2);
|
if (fstat(Fileno(fd), &sb2) == 0)
|
||||||
#else
|
#else
|
||||||
Stat(tfn, &sb2);
|
if (Stat(tfn, &sb2) == 0)
|
||||||
#endif
|
#endif
|
||||||
if (sb2.st_ino != sb.st_ino || sb2.st_dev != sb.st_dev) {
|
{
|
||||||
rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), tfn);
|
if (sb2.st_ino != sb.st_ino || sb2.st_dev != sb.st_dev) {
|
||||||
xfree(tfn);
|
rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), tfn);
|
||||||
return 1;
|
xfree(tfn);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fnptr)
|
if (fnptr)
|
||||||
|
|
15
lib/rpmio.h
15
lib/rpmio.h
|
@ -18,7 +18,7 @@ typedef /*@null@*/ FD_t fdio_ref_function_t ( /*@only@*/ void * cookie,
|
||||||
typedef /*@null@*/ FD_t fdio_deref_function_t ( /*@only@*/ FD_t fd,
|
typedef /*@null@*/ FD_t fdio_deref_function_t ( /*@only@*/ FD_t fd,
|
||||||
const char * msg, const char * file, unsigned line);
|
const char * msg, const char * file, unsigned line);
|
||||||
|
|
||||||
typedef /*@null@*/ FD_t fdio_new_function_t (FDIO_t iop, const char * msg,
|
typedef /*@null@*/ FD_t fdio_new_function_t (const char * msg,
|
||||||
const char * file, unsigned line);
|
const char * file, unsigned line);
|
||||||
|
|
||||||
typedef int fdio_fileno_function_t (void * cookie);
|
typedef int fdio_fileno_function_t (void * cookie);
|
||||||
|
@ -89,9 +89,15 @@ int Access (const char * path, int amode);
|
||||||
|
|
||||||
/*@observer@*/ extern FDIO_t gzdio;
|
/*@observer@*/ extern FDIO_t gzdio;
|
||||||
|
|
||||||
|
void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno);
|
||||||
|
void fdPop(FD_t fd);
|
||||||
|
|
||||||
void fdSetFdno(FD_t fd, int fdno);
|
void fdSetFdno(FD_t fd, int fdno);
|
||||||
/*@null@*/ const FDIO_t fdGetIoCookie(FD_t fd);
|
off_t fdSize(FD_t fd);
|
||||||
void fdSetIoCookie(FD_t fd, FDIO_t iop);
|
void fdSetSyserrno(FD_t fd, int syserrno, const void * errcookie);
|
||||||
|
|
||||||
|
/*@null@*/ const FDIO_t fdGetIo(FD_t fd);
|
||||||
|
void fdSetIo(FD_t fd, FDIO_t io);
|
||||||
|
|
||||||
int fdGetRdTimeoutSecs(FD_t fd);
|
int fdGetRdTimeoutSecs(FD_t fd);
|
||||||
|
|
||||||
|
@ -115,7 +121,7 @@ extern /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
|
||||||
|
|
||||||
#define fdLink(_fd, _msg) fdio->ref(_fd, _msg, __FILE__, __LINE__)
|
#define fdLink(_fd, _msg) fdio->ref(_fd, _msg, __FILE__, __LINE__)
|
||||||
#define fdFree(_fd, _msg) fdio->deref(_fd, _msg, __FILE__, __LINE__)
|
#define fdFree(_fd, _msg) fdio->deref(_fd, _msg, __FILE__, __LINE__)
|
||||||
#define fdNew(_iop, _msg) fdio->new(_iop, _msg, __FILE__, __LINE__)
|
#define fdNew(_msg) fdio->new(_msg, __FILE__, __LINE__)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define fdFileno fdio->fileno
|
#define fdFileno fdio->fileno
|
||||||
|
@ -131,6 +137,7 @@ extern /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
|
||||||
/*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd);
|
/*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd);
|
||||||
/*@observer@*/ const char * urlStrerror(const char * url);
|
/*@observer@*/ const char * urlStrerror(const char * url);
|
||||||
|
|
||||||
|
int ufdCopy(FD_t sfd, FD_t tfd);
|
||||||
int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd);
|
int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd);
|
||||||
const char *const ftpStrerror(int errorNumber);
|
const char *const ftpStrerror(int errorNumber);
|
||||||
|
|
||||||
|
|
47
lib/rpmrc.c
47
lib/rpmrc.c
|
@ -104,7 +104,7 @@ static int currTables[2] = { RPM_MACHTABLE_INSTOS, RPM_MACHTABLE_INSTARCH };
|
||||||
static struct rpmvarValue values[RPMVAR_NUM];
|
static struct rpmvarValue values[RPMVAR_NUM];
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static int doReadRC(FD_t fd, const char * filename);
|
static int doReadRC(FD_t fd, const char * urlfn);
|
||||||
static void rpmSetVarArch(int var, const char * val, const char * arch);
|
static void rpmSetVarArch(int var, const char * val, const char * arch);
|
||||||
static void rebuildCompatTables(int type, const char *name);
|
static void rebuildCompatTables(int type, const char *name);
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ int rpmReadRC(const char * rcfiles)
|
||||||
strcat(fn, r);
|
strcat(fn, r);
|
||||||
|
|
||||||
/* Read another rcfile */
|
/* Read another rcfile */
|
||||||
fd = Fopen(fn, "r.ufdio");
|
fd = Fopen(fn, "r.fpio");
|
||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
|
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
|
||||||
if (rcfiles == defrcfiles && myrcfiles != r)
|
if (rcfiles == defrcfiles && myrcfiles != r)
|
||||||
|
@ -579,7 +579,7 @@ int rpmReadRC(const char * rcfiles)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
char *se, *next;
|
char *se, *next;
|
||||||
|
@ -587,17 +587,18 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
struct rpmOption searchOption, * option;
|
struct rpmOption searchOption, * option;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* XXX fstat doesn't work on ufdio, default to 64K */
|
/* XXX really need rc = Slurp(fd, const char * filename, char ** buf) */
|
||||||
{ struct stat sb;
|
{ off_t size = fdSize(fd);
|
||||||
int fdno = Fileno(fd);
|
size_t nb = (size >= 0 ? size : (8*BUFSIZ - 2));
|
||||||
size_t nb;
|
if (nb == 0) {
|
||||||
fstat(fdno, &sb);
|
Fclose(fd);
|
||||||
nb = (sb.st_size > 0 ? sb.st_size : (8*BUFSIZ - 2));
|
return 0;
|
||||||
|
}
|
||||||
next = alloca(nb + 2);
|
next = alloca(nb + 2);
|
||||||
next[0] = '\0';
|
next[0] = '\0';
|
||||||
rc = Fread(next, sizeof(*next), nb, fd);
|
rc = Fread(next, sizeof(*next), nb, fd);
|
||||||
if (Ferror(fd) || (sb.st_size > 0 && rc != nb)) { /* XXX Feof(fd) */
|
if (Ferror(fd) || (size > 0 && rc != nb)) { /* XXX Feof(fd) */
|
||||||
rpmError(RPMERR_RPMRC, _("Failed to read %s: %s."), filename,
|
rpmError(RPMERR_RPMRC, _("Failed to read %s: %s."), urlfn,
|
||||||
Fstrerror(fd));
|
Fstrerror(fd));
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else
|
} else
|
||||||
|
@ -635,7 +636,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
|
|
||||||
if (*se != ':') {
|
if (*se != ':') {
|
||||||
rpmError(RPMERR_RPMRC, _("missing ':' (found 0x%02x) at %s:%d"),
|
rpmError(RPMERR_RPMRC, _("missing ':' (found 0x%02x) at %s:%d"),
|
||||||
(0xff & *se), filename, linenum);
|
(0xff & *se), urlfn, linenum);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*se++ = '\0'; /* terminate keyword or option, point to value */
|
*se++ = '\0'; /* terminate keyword or option, point to value */
|
||||||
|
@ -652,7 +653,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
arch = val = fn = NULL;
|
arch = val = fn = NULL;
|
||||||
if (*se == '\0') {
|
if (*se == '\0') {
|
||||||
rpmError(RPMERR_RPMRC, _("missing argument for %s at %s:%d"),
|
rpmError(RPMERR_RPMRC, _("missing argument for %s at %s:%d"),
|
||||||
option->name, filename, linenum);
|
option->name, urlfn, linenum);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,16 +670,16 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
fn = rpmGetPath(s, NULL);
|
fn = rpmGetPath(s, NULL);
|
||||||
if (fn == NULL || *fn == '\0') {
|
if (fn == NULL || *fn == '\0') {
|
||||||
rpmError(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\""),
|
rpmError(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\""),
|
||||||
option->name, filename, linenum, s);
|
option->name, urlfn, linenum, s);
|
||||||
if (fn) xfree(fn);
|
if (fn) xfree(fn);
|
||||||
return 1;
|
return 1;
|
||||||
/*@notreached@*/
|
/*@notreached@*/
|
||||||
}
|
}
|
||||||
|
|
||||||
fdinc = Fopen(fn, "r.ufdio");
|
fdinc = Fopen(fn, "r.fpio");
|
||||||
if (fdinc == NULL || Ferror(fdinc)) {
|
if (fdinc == NULL || Ferror(fdinc)) {
|
||||||
rpmError(RPMERR_RPMRC, _("cannot open %s at %s:%d: %s"),
|
rpmError(RPMERR_RPMRC, _("cannot open %s at %s:%d: %s"),
|
||||||
fn, filename, linenum, Fstrerror(fdinc));
|
fn, urlfn, linenum, Fstrerror(fdinc));
|
||||||
rc = 1;
|
rc = 1;
|
||||||
} else {
|
} else {
|
||||||
rc = doReadRC(fdinc, fn);
|
rc = doReadRC(fdinc, fn);
|
||||||
|
@ -691,7 +692,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
fn = rpmGetPath(se, NULL);
|
fn = rpmGetPath(se, NULL);
|
||||||
if (fn == NULL || *fn == '\0') {
|
if (fn == NULL || *fn == '\0') {
|
||||||
rpmError(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\""),
|
rpmError(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\""),
|
||||||
option->name, filename, linenum, fn);
|
option->name, urlfn, linenum, fn);
|
||||||
if (fn) xfree(fn);
|
if (fn) xfree(fn);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +719,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
if (*se == '\0') {
|
if (*se == '\0') {
|
||||||
rpmError(RPMERR_RPMRC,
|
rpmError(RPMERR_RPMRC,
|
||||||
_("missing architecture for %s at %s:%d"),
|
_("missing architecture for %s at %s:%d"),
|
||||||
option->name, filename, linenum);
|
option->name, urlfn, linenum);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*se++ = '\0';
|
*se++ = '\0';
|
||||||
|
@ -726,7 +727,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
if (*se == '\0') {
|
if (*se == '\0') {
|
||||||
rpmError(RPMERR_RPMRC,
|
rpmError(RPMERR_RPMRC,
|
||||||
_("missing argument for %s at %s:%d"),
|
_("missing argument for %s at %s:%d"),
|
||||||
option->name, filename, linenum);
|
option->name, urlfn, linenum);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -763,7 +764,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
if (*rest == '_') rest++;
|
if (*rest == '_') rest++;
|
||||||
|
|
||||||
if (!strcmp(rest, "compat")) {
|
if (!strcmp(rest, "compat")) {
|
||||||
if (machCompatCacheAdd(se, filename, linenum,
|
if (machCompatCacheAdd(se, urlfn, linenum,
|
||||||
&tables[i].cache))
|
&tables[i].cache))
|
||||||
return 1;
|
return 1;
|
||||||
gotit = 1;
|
gotit = 1;
|
||||||
|
@ -771,13 +772,13 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
!strcmp(rest, "translate")) {
|
!strcmp(rest, "translate")) {
|
||||||
if (addDefault(&tables[i].defaults,
|
if (addDefault(&tables[i].defaults,
|
||||||
&tables[i].defaultsLength,
|
&tables[i].defaultsLength,
|
||||||
se, filename, linenum))
|
se, urlfn, linenum))
|
||||||
return 1;
|
return 1;
|
||||||
gotit = 1;
|
gotit = 1;
|
||||||
} else if (tables[i].hasCanon &&
|
} else if (tables[i].hasCanon &&
|
||||||
!strcmp(rest, "canon")) {
|
!strcmp(rest, "canon")) {
|
||||||
if (addCanon(&tables[i].canons, &tables[i].canonsLength,
|
if (addCanon(&tables[i].canons, &tables[i].canonsLength,
|
||||||
se, filename, linenum))
|
se, urlfn, linenum))
|
||||||
return 1;
|
return 1;
|
||||||
gotit = 1;
|
gotit = 1;
|
||||||
}
|
}
|
||||||
|
@ -785,7 +786,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
|
||||||
|
|
||||||
if (!gotit) {
|
if (!gotit) {
|
||||||
rpmError(RPMERR_RPMRC, _("bad option '%s' at %s:%d"),
|
rpmError(RPMERR_RPMRC, _("bad option '%s' at %s:%d"),
|
||||||
s, filename, linenum);
|
s, urlfn, linenum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
lib/url.c
10
lib/url.c
|
@ -64,20 +64,22 @@ DBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, li
|
||||||
if (--u->nrefs > 0)
|
if (--u->nrefs > 0)
|
||||||
return u;
|
return u;
|
||||||
if (u->ctrl) {
|
if (u->ctrl) {
|
||||||
|
void * uctrl = u->ctrl;
|
||||||
if (fdio->fileno(u->ctrl) >= 0)
|
if (fdio->fileno(u->ctrl) >= 0)
|
||||||
fdio->close(u->ctrl);
|
fdio->close(u->ctrl);
|
||||||
u->ctrl = fdio->deref(u->ctrl, "persist ctrl (urlFree)", file, line);
|
u->ctrl = fdio->deref(u->ctrl, "persist ctrl (urlFree)", file, line);
|
||||||
if (u->ctrl)
|
if (u->ctrl)
|
||||||
fprintf(stderr, _("warning: u %p ctrl nrefs != 0 (%s %s)\n"),
|
fprintf(stderr, _("warning: u %p ctrl %p nrefs != 0 (%s %s)\n"),
|
||||||
u, u->host, u->service);
|
u, uctrl, u->host, u->service);
|
||||||
}
|
}
|
||||||
if (u->data) {
|
if (u->data) {
|
||||||
|
void * udata = u->data;
|
||||||
if (fdio->fileno(u->data) >= 0)
|
if (fdio->fileno(u->data) >= 0)
|
||||||
fdio->close(u->data);
|
fdio->close(u->data);
|
||||||
u->data = fdio->deref(u->data, "persist data (urlFree)", file, line);
|
u->data = fdio->deref(u->data, "persist data (urlFree)", file, line);
|
||||||
if (u->data)
|
if (u->data)
|
||||||
fprintf(stderr, _("warning: data nrefs != 0 (%s %s)\n"),
|
fprintf(stderr, _("warning: u %p data %p nrefs != 0 (%s %s)\n"),
|
||||||
u, u->host, u->service);
|
u, udata, u->host, u->service);
|
||||||
}
|
}
|
||||||
if (u->buf) {
|
if (u->buf) {
|
||||||
free(u->buf);
|
free(u->buf);
|
||||||
|
|
726
po/rpm.pot
726
po/rpm.pot
File diff suppressed because it is too large
Load Diff
3
rpm.c
3
rpm.c
|
@ -70,6 +70,7 @@ static int initdb;
|
||||||
static int justdb;
|
static int justdb;
|
||||||
static int noDeps;
|
static int noDeps;
|
||||||
static int noGpg;
|
static int noGpg;
|
||||||
|
extern int noLibio;
|
||||||
static int noMd5;
|
static int noMd5;
|
||||||
static int noOrder;
|
static int noOrder;
|
||||||
static int noPgp;
|
static int noPgp;
|
||||||
|
@ -132,6 +133,7 @@ static struct poptOption optionsTable[] = {
|
||||||
{ "justdb", '\0', 0, &justdb, 0, NULL, NULL},
|
{ "justdb", '\0', 0, &justdb, 0, NULL, NULL},
|
||||||
{ "nodeps", '\0', 0, &noDeps, 0, NULL, NULL},
|
{ "nodeps", '\0', 0, &noDeps, 0, NULL, NULL},
|
||||||
{ "nogpg", '\0', 0, &noGpg, 0, NULL, NULL},
|
{ "nogpg", '\0', 0, &noGpg, 0, NULL, NULL},
|
||||||
|
{ "nolibio", '\0', 0, &noLibio, 0, NULL, NULL},
|
||||||
{ "nomd5", '\0', 0, &noMd5, 0, NULL, NULL},
|
{ "nomd5", '\0', 0, &noMd5, 0, NULL, NULL},
|
||||||
{ "noorder", '\0', 0, &noOrder, 0, NULL, NULL},
|
{ "noorder", '\0', 0, &noOrder, 0, NULL, NULL},
|
||||||
{ "nopgp", '\0', 0, &noPgp, 0, NULL, NULL},
|
{ "nopgp", '\0', 0, &noPgp, 0, NULL, NULL},
|
||||||
|
@ -581,6 +583,7 @@ int main(int argc, const char ** argv)
|
||||||
justdb = 0;
|
justdb = 0;
|
||||||
noDeps = 0;
|
noDeps = 0;
|
||||||
noGpg = 0;
|
noGpg = 0;
|
||||||
|
noLibio = 0;
|
||||||
noMd5 = 0;
|
noMd5 = 0;
|
||||||
noOrder = 0;
|
noOrder = 0;
|
||||||
noPgp = 0;
|
noPgp = 0;
|
||||||
|
|
27
rpm2cpio.c
27
rpm2cpio.c
|
@ -7,10 +7,8 @@
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
FD_t fdi, fdo;
|
FD_t fdi, fdo;
|
||||||
Header hd;
|
Header h;
|
||||||
int rc, isSource;
|
int rc, isSource;
|
||||||
char buffer[1024];
|
|
||||||
int ct;
|
|
||||||
FD_t gzdi;
|
FD_t gzdi;
|
||||||
|
|
||||||
setprogname(argv[0]); /* Retrofit glibc __progname */
|
setprogname(argv[0]); /* Retrofit glibc __progname */
|
||||||
|
@ -20,13 +18,13 @@ int main(int argc, char **argv)
|
||||||
fdi = Fopen(argv[1], "r.ufdio");
|
fdi = Fopen(argv[1], "r.ufdio");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Fileno(fdi) < 0) {
|
if (fdi == NULL || Ferror(fdi)) {
|
||||||
perror("cannot open package");
|
fprintf(stderr, _("cannot open package: %s\n"), Fstrerror(fdi));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
fdo = fdDup(STDOUT_FILENO);
|
fdo = fdDup(STDOUT_FILENO);
|
||||||
|
|
||||||
rc = rpmReadPackageHeader(fdi, &hd, &isSource, NULL, NULL);
|
rc = rpmReadPackageHeader(fdi, &h, &isSource, NULL, NULL);
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
|
@ -40,12 +38,15 @@ int main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DYING
|
|
||||||
gzdi = gzdFdopen(fdi, "r"); /* XXX gzdi == fdi */
|
|
||||||
#else
|
|
||||||
gzdi = Fdopen(fdi, "r.gzdio"); /* XXX gzdi == fdi */
|
gzdi = Fdopen(fdi, "r.gzdio"); /* XXX gzdi == fdi */
|
||||||
#endif
|
if (gzdi == NULL || Ferror(gzdi)) {
|
||||||
|
fprintf(stderr, _("cannot re-open payload: %s\n"), Fstrerror(gzdi));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DYING
|
||||||
|
{ char buffer[BUFSIZ];
|
||||||
|
int ct;
|
||||||
while ((ct = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), gzdi)) > 0) {
|
while ((ct = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), gzdi)) > 0) {
|
||||||
Fwrite(buffer, sizeof(buffer[0]), ct, fdo);
|
Fwrite(buffer, sizeof(buffer[0]), ct, fdo);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +57,12 @@ int main(int argc, char **argv)
|
||||||
} else {
|
} else {
|
||||||
rc = EXIT_SUCCESS;
|
rc = EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
rc = ufdCopy(gzdi, fdo);
|
||||||
|
rc = (rc <= 0) ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
|
Fclose(fdo);
|
||||||
|
#endif
|
||||||
|
|
||||||
Fclose(gzdi); /* XXX gzdi == fdi */
|
Fclose(gzdi); /* XXX gzdi == fdi */
|
||||||
|
|
||||||
|
|
|
@ -1300,7 +1300,7 @@ initMacros(MacroContext *mc, const char *macrofiles)
|
||||||
strncat(buf, mfile, sizeof(buf) - strlen(buf));
|
strncat(buf, mfile, sizeof(buf) - strlen(buf));
|
||||||
buf[sizeof(buf)-1] = '\0';
|
buf[sizeof(buf)-1] = '\0';
|
||||||
|
|
||||||
fd = Fopen(buf, "r.ufdio");
|
fd = Fopen(buf, "r.fpio");
|
||||||
if (fd == NULL || Ferror(fd))
|
if (fd == NULL || Ferror(fd))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1357,11 +1357,7 @@ int isCompressed(const char *file, int *compressed)
|
||||||
|
|
||||||
*compressed = COMPRESSED_NOT;
|
*compressed = COMPRESSED_NOT;
|
||||||
|
|
||||||
#ifdef DYING
|
|
||||||
fd = fdOpen(file, O_RDONLY, 0);
|
|
||||||
#else
|
|
||||||
fd = Fopen(file, "r.ufdio");
|
fd = Fopen(file, "r.ufdio");
|
||||||
#endif
|
|
||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
/* XXX Fstrerror */
|
/* XXX Fstrerror */
|
||||||
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, Fstrerror(fd));
|
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, Fstrerror(fd));
|
||||||
|
|
|
@ -147,13 +147,13 @@ varprefix = @varprefix@
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = 1.4 foreign
|
AUTOMAKE_OPTIONS = 1.4 foreign
|
||||||
|
|
||||||
EXTRA_DIST = convertrpmrc.sh find-lang.sh freshen.sh getpo.sh perl.prov perl.req vpkg-provides.sh
|
EXTRA_DIST = convertrpmrc.sh find-lang.sh find-prov.pl find-req.pl freshen.sh get_magic.pl getpo.sh http.req magic.prov magic.req perl.prov perl.req rpmdiff u_pkg.sh vpkg-provides.sh vpkg-provides2.sh
|
||||||
|
|
||||||
|
|
||||||
installprefix = $(DESTDIR)
|
installprefix = $(DESTDIR)
|
||||||
|
|
||||||
configdir = ${prefix}/lib/rpm
|
configdir = ${prefix}/lib/rpm
|
||||||
config_SCRIPTS = convertrpmrc.sh find-lang.sh freshen.sh getpo.sh perl.prov perl.req vpkg-provides.sh
|
config_SCRIPTS = convertrpmrc.sh find-lang.sh find-prov.pl find-req.pl freshen.sh get_magic.pl getpo.sh http.req magic.prov magic.req perl.prov perl.req rpmdiff u_pkg.sh vpkg-provides.sh vpkg-provides2.sh
|
||||||
|
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
CONFIG_HEADER = ../config.h
|
CONFIG_HEADER = ../config.h
|
||||||
|
|
|
@ -761,7 +761,7 @@ rewriteBinaryRPM(char *fni, char *fno, message_list_ty *mlp)
|
||||||
DPRINTF(99, ("rewriteBinaryRPM(\"%s\",\"%s\",%p)\n", fni, fno, mlp));
|
DPRINTF(99, ("rewriteBinaryRPM(\"%s\",\"%s\",%p)\n", fni, fno, mlp));
|
||||||
|
|
||||||
csa->cpioArchiveSize = 0;
|
csa->cpioArchiveSize = 0;
|
||||||
csa->cpioFdIn = fdNew(fdio, "init (rewriteBinary)");
|
csa->cpioFdIn = fdNew("init (rewriteBinary)");
|
||||||
csa->cpioList = NULL;
|
csa->cpioList = NULL;
|
||||||
csa->cpioCount = 0;
|
csa->cpioCount = 0;
|
||||||
csa->lead = &lead; /* XXX FIXME: exorcize lead/arch/os */
|
csa->lead = &lead; /* XXX FIXME: exorcize lead/arch/os */
|
||||||
|
|
|
@ -444,7 +444,7 @@ rewriteRPM(const char *fni, const char *fno, cmd_t *cmds[], int ncmds)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
csa->cpioArchiveSize = 0;
|
csa->cpioArchiveSize = 0;
|
||||||
csa->cpioFdIn = fdNew(fdio, "init (rewriteRPM)");
|
csa->cpioFdIn = fdNew("init (rewriteRPM)");
|
||||||
csa->cpioList = NULL;
|
csa->cpioList = NULL;
|
||||||
csa->cpioCount = 0;
|
csa->cpioCount = 0;
|
||||||
csa->lead = &lead; /* XXX FIXME: exorcize lead/arch/os */
|
csa->lead = &lead; /* XXX FIXME: exorcize lead/arch/os */
|
||||||
|
|
Loading…
Reference in New Issue