Rip out --enable-bzip2-payload, we'll use Fopen w macros instead.
Work out ref counting for ftpControl so that control channel is persistent.
build/build.c: Use fpio to write build stage script.
parseSpec.c: Rework include stack to use FD_t, not FILE *.
tread.c: Delete, use ufdio->read instead.
rpmio.c: Filter out fdio fd == NULL assertion failures.
rpmrc.c: Don't fail if HOME is not environment.
rpmrc.c: Rework ufdio FTP rcfile I/O to be more similar to stdio.
CVS patchset: 3417
CVS date: 1999/11/04 21:26:08
int count;
int checking;
- fd = ufdio->open(specfile, O_RDONLY, 0);
+ fd = Fopen(specfile, "r.ufdio");
if (Ferror(fd)) {
/* XXX Fstrerror */
fprintf(stderr, _("Unable to open spec file: %s\n"), specfile);
int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
{
FD_t fd;
- FILE *f;
+ FD_t xfd;
const char *scriptName;
int pid;
int status;
return RPMERR_SCRIPT;
}
#ifdef HAVE_FCHMOD
- (void)fchmod(Fileno(fd), 0600);
+ (void)fchmod(Fileno(fd), 0600); /* XXX fubar on ufdio */
#endif
- f = fdFdopen(fd, "w");
+ xfd = Fdopen(fd, "w.fdio");
strcpy(buf, _preScriptEnvironment);
expandMacros(spec, spec->macros, buf, sizeof(buf));
strcat(buf, "\n");
- fputs(buf, f);
+ fputs(buf, fpio->ffileno(xfd));
- fprintf(f, rpmIsVerbose() ? "set -x\n\n" : "exec > /dev/null\n\n");
+ fprintf(fpio->ffileno(xfd), rpmIsVerbose() ? "set -x\n\n" : "exec > /dev/null\n\n");
/* XXX umask 022; cd %{_builddir} */
strcpy(buf, _preScriptChdir);
expandMacros(spec, spec->macros, buf, sizeof(buf));
- fputs(buf, f);
+ fputs(buf, fpio->ffileno(xfd));
if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD) {
if (spec->buildSubdir)
- fprintf(f, "cd %s\n", spec->buildSubdir);
+ fprintf(fpio->ffileno(xfd), "cd %s\n", spec->buildSubdir);
}
if (what == RPMBUILD_RMBUILD) {
if (spec->buildSubdir)
- fprintf(f, "rm -rf %s\n", spec->buildSubdir);
+ fprintf(fpio->ffileno(xfd), "rm -rf %s\n", spec->buildSubdir);
} else
- fprintf(f, "%s", getStringBuf(sb));
- fprintf(f, "\nexit 0\n");
+ fprintf(fpio->ffileno(xfd), "%s", getStringBuf(sb));
+ fprintf(fpio->ffileno(xfd), "\nexit 0\n");
- fclose(f);
+ Fclose(xfd);
if (test) {
FREE(scriptName);
static int addFileToTag(Spec spec, char *file, Header h, int tag);
static int addFileToArrayTag(Spec spec, char *file, Header h, int tag);
-#if ENABLE_BZIP2_PAYLOAD
-static int cpio_bzip2(FD_t fdo, CSA_t *csa);
-#endif /* ENABLE_BZIP2_PAYLOAD */
-
-static int cpio_gzip(FD_t fdo, CSA_t *csa);
+static int cpio_doio(FD_t fdo, CSA_t *csa, const char * fmode);
static int cpio_copy(FD_t fdo, CSA_t *csa);
static inline int genSourceRpmName(Spec spec)
int rc;
if (fileName != NULL) {
- fdi = fdio->open(fileName, O_RDONLY, 0644);
+ fdi = Fopen(fileName, "r.fdio");
if (Ferror(fdi)) {
/* XXX Fstrerror */
rpmError(RPMERR_BADMAGIC, _("readRPM: open %s: %s\n"), fileName,
rc = RPMERR_NOSPACE;
} else { /* Write the archive and get the size */
if (csa->cpioList != NULL) {
- rc = cpio_gzip(fd, csa);
+ rc = cpio_doio(fd, csa, "w9.gzdio");
} else if (Fileno(csa->cpioFdIn) >= 0) {
rc = cpio_copy(fd, csa);
} else {
}
/* Open the output file */
- fd = fdio->open(fileName, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ fd = Fopen(fileName, "w.fdio");
if (Ferror(fd)) {
/* XXX Fstrerror */
rpmError(RPMERR_CREATE, _("Could not open %s\n"), fileName);
rpmFreeSignature(sig);
/* Append the header and archive */
- ifd = fdio->open(sigtarget, O_RDONLY, 0);
+ ifd = Fopen(sigtarget, "r.fdio");
while ((count = Fread(buf, sizeof(buf), 1, ifd)) > 0) {
if (count == -1) {
rpmError(RPMERR_READERROR, _("Unable to read sigtarget: %s"),
return 0;
}
-#if ENABLE_BZIP2_PAYLOAD
-static int cpio_bzip2(FD_t fdo, CSA_t *csa)
-{
- FD_t cfd;
- int rc;
- const char *failedFile = NULL;
-
-#if 0
- cfd = bzdFdopen(fdDup(Fileno(fdo)), "w9");
-#else
- cfd = Fdopen(fdDup(Fileno(fdo)), "w9.bzdio");
-#endif
- rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
- &csa->cpioArchiveSize, &failedFile);
- if (rc) {
- rpmError(RPMERR_CPIO, _("create archive failed on file %s: %s"),
- failedFile, cpioStrerror(rc));
- rc = 1;
- }
-
- Fclose(cfd);
- if (failedFile)
- xfree(failedFile);
-
- return rc;
-}
-#endif /* ENABLE_BZIP2_PAYLOAD */
-
-static int cpio_gzip(FD_t fdo, CSA_t *csa)
+static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmode)
{
FD_t cfd;
int rc;
const char *failedFile = NULL;
-#if 0
- cfd = gzdFdopen(fdDup(Fileno(fdo)), "w9");
-#else
- cfd = Fdopen(fdDup(Fileno(fdo)), "w9.gzdio");
-#endif
+ cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
&csa->cpioArchiveSize, &failedFile);
if (rc) {
icon = xmalloc(statbuf.st_size);
*icon = '\0';
- fd = fdio->open(fn, O_RDONLY, 0);
+ fd = Fopen(fn, "r.fdio");
/* XXX Fstrerror */
/* XXX Ferror check */
nb = Fread(icon, statbuf.st_size, 1, fd);
retry:
/* Make sure the current file is open */
- if (ofi->file == NULL) {
- if (!(ofi->file = Fopen(ofi->fileName, "r"))) {
+ if (ofi->fd == NULL) {
+ if ((ofi->fd = Fopen(ofi->fileName, "r.ufdio")) == NULL) {
/* XXX Fstrerror */
rpmError(RPMERR_BADSPEC, _("Unable to open: %s\n"),
ofi->fileName);
/* Make sure we have something in the read buffer */
if (!(ofi->readPtr && *(ofi->readPtr))) {
- if (!fgets(ofi->readBuf, BUFSIZ, ofi->file)) {
+ if (!fgets(ofi->readBuf, BUFSIZ, fpio->ffileno(ofi->fd))) {
/* EOF */
if (spec->readStack->next) {
rpmError(RPMERR_UNMATCHEDIF, _("Unclosed %%if"));
/* remove this file from the stack */
spec->fileStack = ofi->next;
- fclose(ofi->file);
+ Fclose(ofi->fd);
FREE(ofi->fileName);
free(ofi);
while (spec->fileStack) {
ofi = spec->fileStack;
spec->fileStack = spec->fileStack->next;
- if (ofi->file) fclose(ofi->file);
+ if (ofi->fd) Fclose(ofi->fd);
FREE(ofi->fileName);
free(ofi);
}
typedef struct OpenFileInfo {
/*@only@*/ char *fileName;
- /*@dependent@*/ FILE *file;
+ /*@dependent@*/ FD_t fd;
int lineNum;
char readBuf[BUFSIZ];
/*@dependent@*/ char *readPtr;
struct OpenFileInfo *ofi;
ofi = xmalloc(sizeof(struct OpenFileInfo));
- ofi->file = NULL;
+ ofi->fd = NULL;
ofi->fileName = NULL;
ofi->lineNum = 0;
ofi->readBuf[0] = '\0';
AC_MSG_RESULT($with_v4_packages)
test "$with_v4_packages" = yes && AC_DEFINE(ENABLE_V4_PACKAGES)
-### use option --enable-bzip2-payload to turn on support for packages with bzip2 payloads
-AC_MSG_CHECKING(if you want support for packages with bzip2 payloads)
-AC_ARG_ENABLE(bzip2-payload,
- [ --enable-bzip2-payload[=no] [experimental] support for packages with bzip2 paylaods],
- [with_bzip2_payload=$enableval],
- [with_bzip2_payload=no])
-AC_MSG_RESULT($with_bzip2_payload)
-test "$with_bzip2_payload" = yes && AC_DEFINE(ENABLE_BZIP2_PAYLOAD)
-
dnl Checks for libraries.
AC_CHECK_FUNC(strcasecmp, [], [
messages.c misc.c oldheader.c package.c problems.c query.c \
rebuilddb.c rpmchecksig.c rpmdb.c rpmerr.c rpminstall.c \
rpmio.c rpmlead.c rpmmalloc.c rpmrc.c signature.c stringbuf.c \
- tagName.c tagtable.c transaction.c tread.c uninstall.c url.c verify.c
+ tagName.c tagtable.c transaction.c uninstall.c url.c verify.c
tagtable.c: rpmlib.h
@echo '#include "system.h"' > tagtable.c
}
}
- ofd = fdio->open(hdr->path, O_CREAT | O_WRONLY, 0);
+ ofd = Fopen(hdr->path, "w.fdio"); /* XXX Fopen adds O_TRUNC */
if (Ferror(ofd))
return CPIOERR_OPEN_FAILED;
size_t nmapped;
#endif
- datafd = fdio->open(map->fsPath, O_RDONLY, 0);
+ /* XXX unbuffered mmap generates *lots* of fdio debugging */
+ datafd = Fopen(map->fsPath, "r.fdio");
if (Ferror(datafd))
return CPIOERR_OPEN_FAILED;
int ftpCheckResponse(urlinfo u, /*@out@*/ char ** str) {
int ec = 0;
- int rc = checkResponse(Fileno(u->ftpControl), ftpTimeoutSecs, &ec, str);
+ int rc = checkResponse(fdio->fileno(u->ftpControl), ftpTimeoutSecs, &ec, str);
switch (ec) {
case 550:
}
fdSetFdno(u->ftpControl, tcpConnect(host, port));
- if (Fileno(u->ftpControl) < 0)
- return Fileno(u->ftpControl);
+ if (fdio->fileno(u->ftpControl) < 0)
+ return fdio->fileno(u->ftpControl);
/* ftpCheckResponse() assumes the socket is nonblocking */
- if (fcntl(Fileno(u->ftpControl), F_SETFL, O_NONBLOCK)) {
+ if (fcntl(fdio->fileno(u->ftpControl), F_SETFL, O_NONBLOCK)) {
rc = FTPERR_FAILED_CONNECT;
goto errxit;
}
if ((rc = ftpCommand(u, "TYPE", "I", NULL)))
goto errxit;
- return Fileno(u->ftpControl);
+ fdLink(u->ftpControl, "open ftpControl");
+ return fdio->fileno(u->ftpControl);
errxit:
fdio->close(u->ftpControl);
if (u->ftpFileDoneNeeded) {
u->ftpFileDoneNeeded = 0;
+ fdFree(u->ftpControl, "ftpFileDone (from ftpFileDone)");
if (ftpCheckResponse(u, NULL))
return FTPERR_BAD_SERVER_RESPONSE;
}
return FTPERR_PASSIVE_ERROR;
fdSetFdno(fd, socket(AF_INET, SOCK_STREAM, IPPROTO_IP));
- if (Fileno(fd) < 0)
+ if (fdio->fileno(fd) < 0)
return FTPERR_FAILED_CONNECT;
/* XXX setsockopt SO_LINGER */
/* XXX setsockopt SO_KEEPALIVE */
/* XXX setsockopt SO_TOS IPTOS_THROUGHPUT */
- while (connect(Fileno(fd), (struct sockaddr *) &dataAddress,
+ while (connect(fdio->fileno(fd), (struct sockaddr *) &dataAddress,
sizeof(dataAddress)) < 0) {
if (errno == EINTR)
continue;
}
u->ftpFileDoneNeeded = 1;
+ fdLink(u->ftpControl, "ftpFileDone");
return 0;
}
if (magicp == HEADER_MAGIC_YES)
i += 2;
- if (timedRead(fd, block, i * sizeof(*block)) != (i * sizeof(*block)))
+ if (timedRead(fd, (char *)block, i * sizeof(*block)) != (i * sizeof(*block)))
return NULL;
i = 0;
*p++ = htonl(dl);
totalSize -= sizeof(int_32) + sizeof(int_32);
- if (timedRead(fd, p, totalSize) != totalSize)
+ if (timedRead(fd, (char *)p, totalSize) != totalSize)
return NULL;
h = headerLoad(dataBlock);
(void)notify(h, RPMCALLBACK_INST_PROGRESS, 0, archiveSize, pkgKey,
notifyData);
-#if 0
- cfd = gzdFdopen(fdDup(Fileno(fd)), "r");
-#else
cfd = Fdopen(fdDup(Fileno(fd)), "r.gzdio");
-#endif
rc = cpioInstallArchive(cfd, map, mappedFiles,
((notify && archiveSize) || specFile) ? callback : NULL,
&info, &failedFile);
unsigned int archiveOffset;
unsigned int groupLength;
- if (timedRead(fd, &lit, sizeof(lit)) != sizeof(lit)) {
+ if (timedRead(fd, (char *)&lit, sizeof(lit)) != sizeof(lit)) {
return strerror(errno);
}
char * rc;
FD_t fd;
- fd = fdio->open(filename, O_RDONLY, 0);
+ fd = Fopen(filename, "r.fdio");
if (Ferror(fd))
/* XXX Fstrerror */
return strerror(errno);
case RPMQV_RPM:
{ FD_t fd;
- fd = ufdio->open(arg, O_RDONLY, 0);
+ fd = Fopen(arg, "r.ufdio");
if (Ferror(fd)) {
/* XXX Fstrerror */
fprintf(stderr, _("open of %s failed: %s\n"), arg,urlStrerror(arg));
switch (what) {
case RPMCALLBACK_INST_OPEN_FILE:
- fd = fdio->open(filename, O_RDONLY, 0);
+ fd = Fopen(filename, "r.fdio");
return fd;
case RPMCALLBACK_INST_CLOSE_FILE:
would create all sorts of confusion later. */
for (filename = packages; *filename; filename++) {
- fd = fdio->open(*filename, O_RDONLY, 0);
+ fd = Fopen(*filename, "r.fdio");
if (Ferror(fd)) {
/* XXX Fstrerror */
rpmMessage(RPMMESS_ERROR, _("cannot open file %s\n"), *filename);
if (numSourcePackages && !stopInstall) {
for (i = 0; i < numSourcePackages; i++) {
- fd = fdio->open(sourcePackages[i], O_RDONLY, 0);
+ fd = Fopen(sourcePackages[i], "r.fdio");
if (Ferror(fd)) {
/* XXX Fstrerror */
rpmMessage(RPMMESS_ERROR, _("cannot open file %s\n"),
FD_t fd;
int rc;
- fd = ufdio->open(arg, O_RDONLY, 0);
+ fd = Fopen(arg, "r.ufdio");
if (Ferror(fd)) {
/* XXX Fstrerror */
rpmMessage(RPMMESS_ERROR, _("cannot open %s\n"), arg);
int Fseek (FD_t fd, long int offset, int whence);
int Fclose ( /*@killref@*/ FD_t fd);
FD_t Fdopen (FD_t fd, const char * fmode);
-FILE * Fopen (const char * path, const char * fmode);
+FD_t Fopen (const char * path, const char * fmode);
int Ferror (FD_t fd);
int Fileno (FD_t fd);
long int fdGetCpioPos(FD_t fd);
extern /*@null@*/ FD_t fdDup(int fdno);
void fdSetCpioPos(FD_t fd, long int cpioPos);
+#ifdef UNUSED
extern /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
+#endif
#if 0
#define fdRead fdio->read
#endif
/*@observer@*/ extern FDIO_t ufdio;
+#define timedRead ufdio->read
/*
* Support for first fit File Allocation I/O.
#include <zlib.h>
-extern /*@null@*/ FD_t gzdFdopen( /*@only@*/ void * cookie, const char * mode);
-
/*@observer@*/ extern FDIO_t gzdio;
#endif /* HAVE_ZLIB_H */
#include <bzlib.h>
-extern /*@null@*/ FD_t bzdFdopen( /*@only@*/ void * cookie, const char * mode);
-
/*@observer@*/ extern FDIO_t bzdio;
#endif /* HAVE_BZLIB_H */
int readLead(FD_t fd, struct rpmlead *lead)
{
- if (timedRead(fd, lead, sizeof(*lead)) != sizeof(*lead)) {
+ if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
rpmError(RPMERR_READERROR, _("read failed: %s (%d)"), strerror(errno),
errno);
return 1;
if (table->list) xfree(table->list);
table->list = NULL;
- /* We have a general graph built using strings instead of pointers.
- Yuck. We have to start at a point at traverse it, remembering how
- far away everything is. */
+ /*
+ * We have a general graph built using strings instead of pointers.
+ * Yuck. We have to start at a point at traverse it, remembering how
+ * far away everything is.
+ */
machAddEquiv(table, key, 1);
machCacheEntryVisit(cache, table, key, 2);
}
if (r[0] == '~' && r[1] == '/') {
char *home = getenv("HOME");
if (home == NULL) {
+ /* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
+ if (rcfiles == defrcfiles && myrcfiles != r)
+ continue;
rpmError(RPMERR_RPMRC, _("Cannot expand %s"), r);
rc = 1;
break;
strcat(fn, r);
/* Read another rcfile */
- fd = ufdio->open(fn, O_RDONLY, 0);
- if (Ferror(fd)) {
+ fd = Fopen(fn, "r.ufdio");
+ if (fd == NULL || Ferror(fd)) {
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
if (rcfiles == defrcfiles && myrcfiles != r)
continue;
fn, strerror(errno));
rc = 1;
break;
+ } else {
+ rc = doReadRC(fd, fn);
}
- rc = doReadRC(fd, fn);
- Fclose(fd);
if (rc) break;
}
if (myrcfiles) free(myrcfiles);
return rc;
}
-static int doReadRC(FD_t fd, const char * filename)
+static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
{
const char *s;
char *se, *next;
struct rpmOption searchOption, * option;
int rc;
+ /* XXX fstat doesn't work on ufdio, default to 64K */
{ struct stat sb;
- fstat(Fileno(fd), &sb);
- next = alloca(sb.st_size + 2);
- if (Fread(next, sb.st_size, 1, fd) != sb.st_size) {
+ int fdno = Fileno(fd);
+ size_t nb;
+ fstat(fdno, &sb);
+ nb = (sb.st_size > 0 ? sb.st_size : 8*BUFSIZ);
+ next = alloca(nb + 2);
+ next[0] = '\0';
+ rc = Fread(next, nb, 1, fd);
+ if (Ferror(fd) || (sb.st_size > 0 && rc != nb)) { /* XXX Feof(fd) */
rpmError(RPMERR_RPMRC, _("Failed to read %s: %s."), filename,
strerror(errno));
- return 1;
- }
- next[sb.st_size] = '\n';
- next[sb.st_size + 1] = '\0';
+ rc = 1;
+ } else
+ rc = 0;
+ Fclose(fd);
+ if (rc) return rc;
+ next[nb] = '\n';
+ next[nb + 1] = '\0';
}
while (*next) {
/*@notreached@*/
}
- fdinc = fdio->open(fn, O_RDONLY, 0);
- if (Ferror(fdinc)) {
+ fdinc = Fopen(fn, "r.ufdio");
+ if (fdinc == NULL || Ferror(fdinc)) {
/* XXX Fstrerror */
rpmError(RPMERR_RPMRC, _("cannot open %s at %s:%d"),
fn, filename, linenum);
rc = 1;
} else {
rc = doReadRC(fdinc, fn);
- Fclose(fdinc);
}
if (fn) xfree(fn);
if (rc) return rc;
#if !defined(__linux__)
#ifdef SNI
- /* USUALLY un.sysname on sinix does start with the word "SINIX"
- * let's be absolutely sure
- */
- sprintf(un.sysname,"SINIX");
+ /* USUALLY un.sysname on sinix does start with the word "SINIX"
+ * let's be absolutely sure
+ */
+ sprintf(un.sysname,"SINIX");
#endif
if (!strcmp(un.sysname, "AIX")) {
strcpy(un.machine, __power_pc() ? "ppc" : "rs6000");
- sprintf(un.sysname,"aix%s.%s",un.version,un.release);
+ sprintf(un.sysname,"aix%s.%s",un.version,un.release);
+ }
+ else if (!strcmp(un.sysname, "SunOS")) {
+ if (!strncmp(un.release,"4", 1)) /* SunOS 4.x */ {
+ int fd;
+ for (fd = 0;
+ (un.release[fd] != 0 && (fd < sizeof(un.release)));
+ fd++) {
+ if (!isdigit(un.release[fd]) && (un.release[fd] != '.')) {
+ un.release[fd] = 0;
+ break;
+ }
+ }
+ sprintf(un.sysname,"sunos%s",un.release);
+ }
+
+ else /* Solaris 2.x: n.x.x becomes n-3.x.x */
+ sprintf(un.sysname, "solaris%1d%s", atoi(un.release)-3,
+ un.release+1+(atoi(un.release)/10));
+ }
+ else if (!strcmp(un.sysname, "HP-UX"))
+ /*make un.sysname look like hpux9.05 for example*/
+ sprintf(un.sysname, "hpux%s", strpbrk(un.release,"123456789"));
+ else if (!strcmp(un.sysname, "OSF1"))
+ /*make un.sysname look like osf3.2 for example*/
+ sprintf(un.sysname,"osf%s",strpbrk(un.release,"123456789"));
+ else if (!strncmp(un.sysname, "IP", 2))
+ un.sysname[2] = '\0';
+ else if (!strncmp(un.sysname, "SINIX", 5)) {
+ sprintf(un.sysname, "sinix%s",un.release);
+ if (!strncmp(un.machine, "RM", 2))
+ sprintf(un.machine, "mips");
+ }
+ else if ((!strncmp(un.machine, "34", 2) ||
+ !strncmp(un.machine, "33", 2)) && \
+ !strncmp(un.release, "4.0", 3))
+ {
+ /* we are on ncr-sysv4 */
+ char *prelid = NULL;
+ FD_t fd;
+ fd = Fopen("/etc/.relid", "r.fdio");
+ if (!Ferror(fd)) {
+ chptr = (char *) xcalloc(1, 256);
+ if (chptr != NULL) {
+ int irelid = Fread(chptr, 256, 1, fd);
+ Fclose(fd);
+ /* example: "112393 RELEASE 020200 Version 01 OS" */
+ if (irelid > 0) {
+ if ((prelid=strstr(chptr, "RELEASE "))){
+ prelid += strlen("RELEASE ")+1;
+ sprintf(un.sysname,"ncr-sysv4.%.*s",1,prelid);
+ }
+ }
+ free (chptr);
+ }
+ }
+ if (prelid == NULL) /* parsing /etc/.relid file failed? */
+ strcpy(un.sysname,"ncr-sysv4");
+ /* wrong, just for now, find out how to look for i586 later*/
+ strcpy(un.machine,"i486");
}
- else if (!strcmp(un.sysname, "SunOS")) {
- if (!strncmp(un.release,"4", 1)) /* SunOS 4.x */ {
- int fd;
- for (fd=0;(un.release[fd] != 0 && (fd < sizeof(un.release)));fd++)
- if (!isdigit(un.release[fd]) && (un.release[fd] != '.')) {
- un.release[fd] = 0;
- break;
- }
- sprintf(un.sysname,"sunos%s",un.release);
- }
-
- else /* Solaris 2.x: n.x.x becomes n-3.x.x */
- sprintf(un.sysname,"solaris%1d%s",atoi(un.release)-3,un.release+1+(atoi(un.release)/10));
- }
- else if (!strcmp(un.sysname, "HP-UX"))
- /*make un.sysname look like hpux9.05 for example*/
- sprintf(un.sysname,"hpux%s",strpbrk(un.release,"123456789"));
- else if (!strcmp(un.sysname, "OSF1"))
- /*make un.sysname look like osf3.2 for example*/
- sprintf(un.sysname,"osf%s",strpbrk(un.release,"123456789"));
- else if (!strncmp(un.sysname, "IP", 2))
- un.sysname[2] = '\0';
- else if (!strncmp(un.sysname, "SINIX", 5)) {
- sprintf(un.sysname, "sinix%s",un.release);
- if (!strncmp(un.machine, "RM", 2))
- sprintf(un.machine, "mips");
- }
- else if ((!strncmp(un.machine, "34", 2) || \
- !strncmp(un.machine, "33", 2)) && \
- !strncmp(un.release, "4.0", 3)) {
- /* we are on ncr-sysv4 */
- char *prelid = NULL;
- FD_t fd = fdio->open("/etc/.relid", O_RDONLY, 0700);
- if (!Ferror(fd)) {
- chptr = (char *) xcalloc(1, 256);
- if (chptr != NULL) {
- int irelid = Fread(chptr, 256, 1, fd);
- Fclose(fd);
- /* example: "112393 RELEASE 020200 Version 01 OS" */
- if (irelid > 0) {
- if ((prelid=strstr(chptr, "RELEASE "))){
- prelid += strlen("RELEASE ")+1;
- sprintf(un.sysname,"ncr-sysv4.%.*s",1,prelid);
- }
- }
- free (chptr);
- }
- }
- if (prelid == NULL) /* parsing /etc/.relid file failed? */
- strcpy(un.sysname,"ncr-sysv4");
- /* wrong, just for now, find out how to look for i586 later*/
- strcpy(un.machine,"i486");
- }
#endif /* __linux__ */
/* get rid of the hyphens in the sysname */
const char *a;
defaultMachine(&a, NULL);
ca = (a) ? xstrdup(a) : NULL;
- }
+ }
for (x = 0; ca[x]; x++)
ca[x] = tolower(ca[x]);
{ FD_t fd;
int rc;
- fd = fdio->open(sigfile, O_RDONLY, 0);
+ fd = Fopen(sigfile, "r.fdio");
rc = timedRead(fd, *sig, *size);
unlink(sigfile);
Fclose(fd);
{ FD_t fd;
int rc;
- fd = fdio->open(sigfile, O_RDONLY, 0);
+ fd = Fopen(sigfile, "r.fdio");
rc = timedRead(fd, *sig, *size);
unlink(sigfile);
Fclose(fd);
sigfile = tempnam(tmppath, "rpmsig");
xfree(tmppath);
}
- sfd = fdio->open(sigfile, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ sfd = Fopen(sigfile, "w.fdio");
(void)Fwrite(sig, count, 1, sfd);
Fclose(sfd);
sigfile = tempnam(tmppath, "rpmsig");
xfree(tmppath);
}
- sfd = fdio->open(sigfile, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ sfd = Fopen(sigfile, "w.fdio");
(void)Fwrite(sig, count, 1, sfd);
Fclose(sfd);
+++ /dev/null
-#include "system.h"
-
-#include <rpmio.h>
-
-int timedRead(FD_t fd, void * bufptr, int length) {
- int bytesRead;
- int total = 0;
- char * buf = bufptr;
- fd_set readSet;
- struct timeval tv;
- struct stat sb;
-
- fstat(Fileno(fd), &sb);
- if (S_ISREG(sb.st_mode))
- return Fread(buf, length, 1, fd);
-
- while (total < length) {
- FD_ZERO(&readSet);
- FD_SET(Fileno(fd), &readSet);
-
- tv.tv_sec = 30; /* FIXME: this should be configurable */
- tv.tv_usec = 0;
-
- if (select(Fileno(fd) + 1, &readSet, NULL, NULL, &tv) != 1)
- return total;
-
- bytesRead = Fread(buf + total, length - total, 1, fd);
-
- if (bytesRead < 0)
- return bytesRead;
- else if (bytesRead == 0)
- return total;
-
- total += bytesRead;
- }
-
- return length;
-}
if (rpmIsVerbose()) {
out = fdDup(Fileno(errfd));
} else {
- out = fdio->open("/dev/null", O_WRONLY, 0);
+ out = Fopen("/dev/null", "w.fdio");
if (Ferror(out))
out = fdDup(Fileno(errfd));
}
memset(u, 0, sizeof(*u));
u->proxyp = -1;
u->port = -1;
- u->ftpControl = fdio->new(fdio, "ftpControl", __FILE__, __LINE__);
+ u->ftpControl = fdio->new(fdio, "url ftpControl", __FILE__, __LINE__);
u->ftpFileDoneNeeded = 0;
u->nrefs = 0;
return XurlLink(u, msg, file, line);
if (--u->nrefs > 0)
return;
if (u->ftpControl) {
- fdio->close(u->ftpControl);
- fdio->deref(u->ftpControl, "ftpControl", __FILE__, __LINE__);
+ if (fdio->fileno(u->ftpControl) >= 0)
+ fdio->close(u->ftpControl);
+ fdio->deref(u->ftpControl, "url ftpControl (from urlFree)", __FILE__, __LINE__);
u->ftpControl = NULL;
}
FREE(u->url);
FD_t tfd = NULL;
urlinfo sfu;
- sfd = ufdio->open(url, O_RDONLY, 0);
+ sfd = Fopen(url, "r.ufdio");
if (sfd == NULL || Ferror(sfd)) {
/* XXX Fstrerror */
rpmMessage(RPMMESS_DEBUG, _("failed to open %s\n"), url);
dest = fileName;
}
- tfd = fdio->open(dest, O_CREAT|O_WRONLY|O_TRUNC, 0600);
+ tfd = Fopen(dest, "w.fdio");
if (Ferror(tfd)) {
/* XXX Fstrerror */
rpmMessage(RPMMESS_DEBUG, _("failed to create %s\n"), dest);
lib/signature.c
lib/stringbuf.c
lib/transaction.c
-lib/tread.c
lib/uninstall.c
lib/url.c
lib/verify.c
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-11-03 15:27-0500\n"
+"POT-Creation-Date: 1999-11-04 15:34-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "error reading header from package\n"
msgstr ""
-#: build/build.c:84 build/pack.c:272
+#: build/build.c:84 build/pack.c:268
msgid "Unable to open temp file"
msgstr ""
msgid "Could not open %%files file: %s"
msgstr ""
-#: build/files.c:1190 build/pack.c:503
+#: build/files.c:1190 build/pack.c:467
#, c-format
msgid "line: %s"
msgstr ""
msgid "Could not canonicalize hostname: %s\n"
msgstr ""
-#: build/pack.c:134
+#: build/pack.c:130
#, c-format
msgid "Could not generate output filename for package %s: %s\n"
msgstr ""
-#: build/pack.c:151
+#: build/pack.c:147
#, c-format
msgid "cannot create %s: %s\n"
msgstr ""
#. XXX Fstrerror
-#: build/pack.c:189
+#: build/pack.c:185
#, c-format
msgid "readRPM: open %s: %s\n"
msgstr ""
-#: build/pack.c:199
+#: build/pack.c:195
#, c-format
msgid "readRPM: read %s: %s\n"
msgstr ""
-#: build/pack.c:220
+#: build/pack.c:216
#, c-format
msgid "readRPM: %s is not an RPM package\n"
msgstr ""
-#: build/pack.c:226
+#: build/pack.c:222
#, c-format
msgid "readRPM: reading header from %s\n"
msgstr ""
-#: build/pack.c:283
+#: build/pack.c:279
msgid "Bad CSA data"
msgstr ""
#. XXX Fstrerror
-#: build/pack.c:318
+#: build/pack.c:314
#, c-format
msgid "Could not open %s\n"
msgstr ""
-#: build/pack.c:350 build/pack.c:392
+#: build/pack.c:346 build/pack.c:388
#, c-format
msgid "Unable to write package: %s"
msgstr ""
-#: build/pack.c:365
+#: build/pack.c:361
#, c-format
msgid "Generating signature: %d\n"
msgstr ""
-#: build/pack.c:382
+#: build/pack.c:378
#, c-format
msgid "Unable to read sigtarget: %s"
msgstr ""
-#: build/pack.c:407
+#: build/pack.c:403
#, c-format
msgid "Wrote: %s\n"
msgstr ""
-#: build/pack.c:427 build/pack.c:454
+#: build/pack.c:418
#, c-format
msgid "create archive failed on file %s: %s"
msgstr ""
-#: build/pack.c:473
+#: build/pack.c:437
#, c-format
msgid "cpio_copy write failed: %s"
msgstr ""
-#: build/pack.c:480
+#: build/pack.c:444
#, c-format
msgid "cpio_copy read failed: %s"
msgstr ""
-#: build/pack.c:559
+#: build/pack.c:523
#, c-format
msgid "Could not open PreIn file: %s"
msgstr ""
-#: build/pack.c:566
+#: build/pack.c:530
#, c-format
msgid "Could not open PreUn file: %s"
msgstr ""
-#: build/pack.c:573
+#: build/pack.c:537
#, c-format
msgid "Could not open PostIn file: %s"
msgstr ""
-#: build/pack.c:580
+#: build/pack.c:544
#, c-format
msgid "Could not open PostUn file: %s"
msgstr ""
-#: build/pack.c:588
+#: build/pack.c:552
#, c-format
msgid "Could not open VerifyScript file: %s"
msgstr ""
-#: build/pack.c:604
+#: build/pack.c:568
#, c-format
msgid "Could not open Trigger script file: %s"
msgstr ""
msgid "getNextHeader: %s\n"
msgstr ""
-#: lib/cpio.c:991
+#: lib/cpio.c:992
#, c-format
msgid "(error 0x%x)"
msgstr ""
-#: lib/cpio.c:994
+#: lib/cpio.c:995
msgid "Bad magic"
msgstr ""
-#: lib/cpio.c:995
+#: lib/cpio.c:996
msgid "Bad/unreadable header"
msgstr ""
-#: lib/cpio.c:1013
+#: lib/cpio.c:1014
msgid "Header size too big"
msgstr ""
-#: lib/cpio.c:1014
+#: lib/cpio.c:1015
msgid "Unknown file type"
msgstr ""
-#: lib/cpio.c:1015
+#: lib/cpio.c:1016
msgid "Missing hard link"
msgstr ""
-#: lib/cpio.c:1016
+#: lib/cpio.c:1017
msgid "Internal error"
msgstr ""
-#: lib/cpio.c:1025
+#: lib/cpio.c:1026
msgid " failed - "
msgstr ""
#. this would probably be a good place to check if disk space
#. was used up - if so, we should return a different error
-#: lib/install.c:359
+#: lib/install.c:355
#, c-format
msgid "unpacking of archive failed%s%s: %s"
msgstr ""
-#: lib/install.c:360
+#: lib/install.c:356
msgid " on file "
msgstr ""
-#: lib/install.c:403
+#: lib/install.c:399
msgid "installing a source package\n"
msgstr ""
-#: lib/install.c:414
+#: lib/install.c:410
#, c-format
msgid "cannot create %s: %s"
msgstr ""
-#: lib/install.c:422 lib/install.c:444
+#: lib/install.c:418 lib/install.c:440
#, c-format
msgid "cannot write to %s"
msgstr ""
-#: lib/install.c:426
+#: lib/install.c:422
#, c-format
msgid "sources in: %s\n"
msgstr ""
-#: lib/install.c:437
+#: lib/install.c:433
#, c-format
msgid "cannot create %s"
msgstr ""
-#: lib/install.c:448
+#: lib/install.c:444
#, c-format
msgid "spec file in: %s\n"
msgstr ""
-#: lib/install.c:482 lib/install.c:510
+#: lib/install.c:478 lib/install.c:506
msgid "source package contains no .spec file"
msgstr ""
-#: lib/install.c:531
+#: lib/install.c:527
#, c-format
msgid "renaming %s to %s\n"
msgstr ""
-#: lib/install.c:533 lib/install.c:811 lib/uninstall.c:27
+#: lib/install.c:529 lib/install.c:807 lib/uninstall.c:27
#, c-format
msgid "rename of %s to %s failed: %s"
msgstr ""
-#: lib/install.c:623
+#: lib/install.c:619
msgid "source package expected, binary found"
msgstr ""
-#: lib/install.c:680
+#: lib/install.c:676
#, c-format
msgid "package: %s-%s-%s files test = %d\n"
msgstr ""
-#: lib/install.c:741
+#: lib/install.c:737
msgid "stopping install as we're running --test\n"
msgstr ""
-#: lib/install.c:746
+#: lib/install.c:742
msgid "running preinstall script (if any)\n"
msgstr ""
-#: lib/install.c:771
+#: lib/install.c:767
#, c-format
msgid "warning: %s created as %s"
msgstr ""
-#: lib/install.c:807
+#: lib/install.c:803
#, c-format
msgid "warning: %s saved as %s"
msgstr ""
-#: lib/install.c:881
+#: lib/install.c:877
msgid "running postinstall scripts (if any)\n"
msgstr ""
msgstr ""
#. XXX Fstrerror
-#: lib/rpmdb.c:156 lib/url.c:373
+#: lib/rpmdb.c:156 lib/url.c:374
#, c-format
msgid "failed to open %s\n"
msgstr ""
msgid "Installing %s\n"
msgstr ""
-#: lib/rpmio.c:229
+#: lib/rpmio.c:246
msgid "Success"
msgstr ""
-#: lib/rpmio.c:232
+#: lib/rpmio.c:249
msgid "Bad server response"
msgstr ""
-#: lib/rpmio.c:235
+#: lib/rpmio.c:252
msgid "Server IO error"
msgstr ""
-#: lib/rpmio.c:238
+#: lib/rpmio.c:255
msgid "Server timeout"
msgstr ""
-#: lib/rpmio.c:241
+#: lib/rpmio.c:258
msgid "Unable to lookup server host address"
msgstr ""
-#: lib/rpmio.c:244
+#: lib/rpmio.c:261
msgid "Unable to lookup server host name"
msgstr ""
-#: lib/rpmio.c:247
+#: lib/rpmio.c:264
msgid "Failed to connect to server"
msgstr ""
-#: lib/rpmio.c:250
+#: lib/rpmio.c:267
msgid "Failed to establish data connection to server"
msgstr ""
-#: lib/rpmio.c:253
+#: lib/rpmio.c:270
msgid "IO error to local file"
msgstr ""
-#: lib/rpmio.c:256
+#: lib/rpmio.c:273
msgid "Error setting remote server to passive mode"
msgstr ""
-#: lib/rpmio.c:259
+#: lib/rpmio.c:276
msgid "File not found on server"
msgstr ""
-#: lib/rpmio.c:262
+#: lib/rpmio.c:279
msgid "Abort in progress"
msgstr ""
-#: lib/rpmio.c:266
+#: lib/rpmio.c:283
msgid "Unknown or unexpected error"
msgstr ""
-#: lib/rpmio.c:301
+#: lib/rpmio.c:318
#, c-format
msgid "logging into %s as %s, pw %s\n"
msgstr ""
msgid "Too many args in default line at %s:%d"
msgstr ""
-#: lib/rpmrc.c:536
+#: lib/rpmrc.c:540
#, c-format
msgid "Cannot expand %s"
msgstr ""
#. XXX Fstrerror
-#: lib/rpmrc.c:552
+#: lib/rpmrc.c:556
#, c-format
msgid "Unable to open %s for reading: %s."
msgstr ""
-#: lib/rpmrc.c:590
+#. XXX Feof(fd)
+#: lib/rpmrc.c:600
#, c-format
msgid "Failed to read %s: %s."
msgstr ""
-#: lib/rpmrc.c:620
+#: lib/rpmrc.c:633
#, c-format
msgid "missing ':' at %s:%d"
msgstr ""
-#: lib/rpmrc.c:637 lib/rpmrc.c:713
+#: lib/rpmrc.c:650 lib/rpmrc.c:725
#, c-format
msgid "missing argument for %s at %s:%d"
msgstr ""
-#: lib/rpmrc.c:654 lib/rpmrc.c:678
+#: lib/rpmrc.c:667 lib/rpmrc.c:690
#, c-format
msgid "%s expansion failed at %s:%d \"%s\""
msgstr ""
#. XXX Fstrerror
-#: lib/rpmrc.c:664
+#: lib/rpmrc.c:677
#, c-format
msgid "cannot open %s at %s:%d"
msgstr ""
-#: lib/rpmrc.c:705
+#: lib/rpmrc.c:717
#, c-format
msgid "missing architecture for %s at %s:%d"
msgstr ""
-#: lib/rpmrc.c:772
+#: lib/rpmrc.c:784
#, c-format
msgid "bad option '%s' at %s:%d"
msgstr ""
-#: lib/rpmrc.c:1134
+#: lib/rpmrc.c:1147
#, c-format
msgid "Unknown system: %s\n"
msgstr ""
-#: lib/rpmrc.c:1135
+#: lib/rpmrc.c:1148
msgid "Please contact rpm-list@redhat.com\n"
msgstr ""
msgid "execution of script failed"
msgstr ""
-#: lib/url.c:176
+#: lib/url.c:177
#, c-format
msgid "Password for %s@%s: "
msgstr ""
-#: lib/url.c:201 lib/url.c:227
+#: lib/url.c:202 lib/url.c:228
#, c-format
msgid "error: %sport must be a number\n"
msgstr ""
-#: lib/url.c:336
+#: lib/url.c:337
msgid "url port must be a number\n"
msgstr ""
#. XXX Fstrerror
-#: lib/url.c:391
+#: lib/url.c:392
#, c-format
msgid "failed to create %s\n"
msgstr ""
PyObject * list;
if (!PyArg_ParseTuple(args, "s", &filespec)) return NULL;
- fd = fdio->open(filespec, O_RDONLY, 0);
+ fd = Fopen(filespec, "r.fdio");
if (!fd) {
PyErr_SetFromErrno(pyrpmError);
if (argc == 1) {
fdi = fdDup(STDIN_FILENO);
} else {
- fdi = ufdio->open(argv[1], O_RDONLY, 0644);
+ fdi = Fopen(argv[1], "r.ufdio");
}
if (Fileno(fdi) < 0) {
if (argc == 1) {
fdi = fdDup(STDIN_FILENO);
} else {
- fdi = ufdio->open(argv[1], O_RDONLY, 0644);
+ fdi = Fopen(argv[1], "r.ufdio");
}
if (Ferror(fdi)) {
if (argc == 1) {
fdi = fdDup(STDIN_FILENO);
} else {
- fdi = ufdio->open(argv[1], O_RDONLY, 0644);
+ fdi = Fopen(argv[1], "r.ufdio");
}
readLead(fdi, &lead);
}
}
- fd = fdio->open(fni, O_RDONLY, 0644);
+ fd = Fopen(fni, "r.fdio");
if (Ferror(fd)) {
/* XXX Fstrerror */
fprintf(stderr, _("rpmgettext: open %s: %s\n"), fni, strerror(errno));
if (argc == 1) {
fdi = fdDup(STDIN_FILENO);
} else {
- fdi = ufdio->open(argv[1], O_RDONLY, 0644);
+ fdi = Fopen(argv[1], "r.ufdio");
if (Ferror(fdi)) {
perror(argv[1]);
exit(EXIT_FAILURE);
if (argc == 1) {
fdi = fdDup(STDIN_FILENO);
} else {
- fdi = ufdio->open(argv[1], O_RDONLY, 0644);
+ fdi = Fopen(argv[1], "r.ufdio");
if (Ferror(fdi)) {
perror(argv[1]);
exit(EXIT_FAILURE);
if (argc == 1) {
fdi = fdDup(STDIN_FILENO);
} else {
- fdi = ufdio->open(argv[1], O_RDONLY, 0644);
+ fdi = Fopen(argv[1], "r.ufdio");
if (Ferror(fdi)) {
perror(argv[1]);
exit(1);