use compressed filenames on install side.
start unifying FD types, CFD_t now gone. CVS patchset: 3402 CVS date: 1999/10/27 23:18:10
This commit is contained in:
parent
82c75cb6a2
commit
0d0b405c20
|
@ -1,4 +1,4 @@
|
|||
-I. -I./build -I./lib -I./popt -DHAVE_CONFIG_H
|
||||
-I. -I./build -I./lib -I./popt -DHAVE_CONFIG_H -D_GNU_SOURCE
|
||||
|
||||
+partial
|
||||
|
||||
|
|
2
CHANGES
2
CHANGES
|
@ -1,4 +1,6 @@
|
|||
3.0.3 -> 3.0.4
|
||||
- use compressed filenames on install side.
|
||||
- start unifying FD types, CFD_t now gone.
|
||||
|
||||
3.0.2 -> 3.0.3
|
||||
- add --eval to find result of macro expansion.
|
||||
|
|
4
build.c
4
build.c
|
@ -61,8 +61,8 @@ static int isSpecFile(const char *specfile)
|
|||
fprintf(stderr, _("Unable to open spec file: %s\n"), specfile);
|
||||
return 0;
|
||||
}
|
||||
count = fdRead(fd, buf, sizeof(buf));
|
||||
fdClose(fd);
|
||||
count = Fread(buf, sizeof(buf), 1, fd);
|
||||
Fclose(fd);
|
||||
|
||||
checking = 1;
|
||||
for (s = buf; count--; s++) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-I. -I.. -I../build -I../lib -I../popt -DHAVE_CONFIG_H
|
||||
-I. -I.. -I../build -I../lib -I../popt -DHAVE_CONFIG_H -D_GNU_SOURCE
|
||||
|
||||
+partial
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
|
|||
}
|
||||
|
||||
if (makeTempFile(NULL, &scriptName, &fd)) {
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
FREE(scriptName);
|
||||
rpmError(RPMERR_SCRIPT, _("Unable to open temp file"));
|
||||
return RPMERR_SCRIPT;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "cpio.h"
|
||||
|
||||
typedef struct cpioSourceArchive {
|
||||
CFD_t cpioCfd;
|
||||
unsigned int cpioArchiveSize;
|
||||
FD_t cpioFdIn;
|
||||
/*@dependent@*/ struct cpioFileMapping *cpioList;
|
||||
|
|
58
build/pack.c
58
build/pack.c
|
@ -63,7 +63,7 @@ int packageSources(Spec spec)
|
|||
|
||||
memset(csa, 0, sizeof(*csa));
|
||||
csa->cpioArchiveSize = 0;
|
||||
csa->cpioFdIn = fdNew();
|
||||
csa->cpioFdIn = fdNew(&fdio);
|
||||
csa->cpioList = spec->sourceCpioList;
|
||||
csa->cpioCount = spec->sourceCpioCount;
|
||||
|
||||
|
@ -158,7 +158,7 @@ int packageBinaries(Spec spec)
|
|||
|
||||
memset(csa, 0, sizeof(*csa));
|
||||
csa->cpioArchiveSize = 0;
|
||||
csa->cpioFdIn = fdNew();
|
||||
csa->cpioFdIn = fdNew(&fdio);
|
||||
csa->cpioList = pkg->cpioList;
|
||||
csa->cpioCount = pkg->cpioCount;
|
||||
|
||||
|
@ -190,12 +190,13 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
|
|||
}
|
||||
|
||||
/* Get copy of lead */
|
||||
if ((rc = fdRead(fdi, lead, sizeof(*lead))) != sizeof(*lead)) {
|
||||
if ((rc = Fread(lead, sizeof(*lead), 1, fdi)) != sizeof(*lead)) {
|
||||
rpmError(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"), fileName,
|
||||
strerror(errno));
|
||||
return RPMERR_BADMAGIC;
|
||||
}
|
||||
(void)fdLseek(fdi, 0, SEEK_SET); /* XXX FIXME: EPIPE */
|
||||
|
||||
(void)Fseek(fdi, 0, SEEK_SET); /* XXX FIXME: EPIPE */
|
||||
|
||||
/* Reallocate build data structures */
|
||||
spec = newSpec();
|
||||
|
@ -228,7 +229,7 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
|
|||
if (csa) {
|
||||
csa->cpioFdIn = fdi;
|
||||
} else {
|
||||
fdClose(fdi);
|
||||
Fclose(fdi);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -279,7 +280,7 @@ int writeRPM(Header h, const char *fileName, int type,
|
|||
}
|
||||
}
|
||||
if (rc != 0) {
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
return rc;
|
||||
|
@ -290,11 +291,13 @@ int writeRPM(Header h, const char *fileName, int type,
|
|||
headerModifyEntry(h, RPMTAG_ARCHIVESIZE,
|
||||
RPM_INT32_TYPE, &csa->cpioArchiveSize, 1);
|
||||
}
|
||||
(void)fdLseek(fd, 0, SEEK_SET);
|
||||
|
||||
(void)Fseek(fd, 0, SEEK_SET);
|
||||
|
||||
if (headerWrite(fd, h, HEADER_MAGIC_YES))
|
||||
rc = RPMERR_NOSPACE;
|
||||
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
unlink(fileName);
|
||||
|
||||
if (rc) {
|
||||
|
@ -339,7 +342,7 @@ int writeRPM(Header h, const char *fileName, int type,
|
|||
if (writeLead(fd, &lead)) {
|
||||
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s"),
|
||||
strerror(errno));
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
unlink(fileName);
|
||||
|
@ -356,7 +359,7 @@ int writeRPM(Header h, const char *fileName, int type,
|
|||
rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
|
||||
}
|
||||
if ((rc = rpmWriteSignature(fd, sig))) {
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
unlink(fileName);
|
||||
|
@ -367,30 +370,30 @@ int writeRPM(Header h, const char *fileName, int type,
|
|||
|
||||
/* Append the header and archive */
|
||||
ifd = fdOpen(sigtarget, O_RDONLY, 0);
|
||||
while ((count = fdRead(ifd, buf, sizeof(buf))) > 0) {
|
||||
while ((count = Fread(buf, sizeof(buf), 1, ifd)) > 0) {
|
||||
if (count == -1) {
|
||||
rpmError(RPMERR_READERROR, _("Unable to read sigtarget: %s"),
|
||||
strerror(errno));
|
||||
fdClose(ifd);
|
||||
fdClose(fd);
|
||||
Fclose(ifd);
|
||||
Fclose(fd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
unlink(fileName);
|
||||
return RPMERR_READERROR;
|
||||
}
|
||||
if (fdWrite(fd, buf, count) < 0) {
|
||||
if (Fwrite(buf, count, 1, fd) < 0) {
|
||||
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s"),
|
||||
strerror(errno));
|
||||
fdClose(ifd);
|
||||
fdClose(fd);
|
||||
Fclose(ifd);
|
||||
Fclose(fd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
unlink(fileName);
|
||||
return RPMERR_NOSPACE;
|
||||
}
|
||||
}
|
||||
fdClose(ifd);
|
||||
fdClose(fd);
|
||||
Fclose(ifd);
|
||||
Fclose(fd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
|
||||
|
@ -402,12 +405,11 @@ int writeRPM(Header h, const char *fileName, int type,
|
|||
#if ENABLE_BZIP2_PAYLOAD
|
||||
static int cpio_bzip2(FD_t fdo, CSA_t *csa)
|
||||
{
|
||||
CFD_t *cfd = &csa->cpioCfd;
|
||||
FD_t cfd;
|
||||
int rc;
|
||||
const char *failedFile = NULL;
|
||||
|
||||
cfd->cpioIoType = cpioIoTypeBzFd;
|
||||
cfd->cpioBzFd = bzdFdopen(fdDup(fdFileno(fdo)), "w9");
|
||||
cfd = bzdFdopen(fdDup(fdFileno(fdo)), "w9");
|
||||
rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
|
||||
&csa->cpioArchiveSize, &failedFile);
|
||||
if (rc) {
|
||||
|
@ -416,7 +418,7 @@ static int cpio_bzip2(FD_t fdo, CSA_t *csa)
|
|||
rc = 1;
|
||||
}
|
||||
|
||||
bzdClose(cfd->cpioBzFd);
|
||||
Fclose(cfd);
|
||||
if (failedFile)
|
||||
xfree(failedFile);
|
||||
|
||||
|
@ -426,12 +428,11 @@ static int cpio_bzip2(FD_t fdo, CSA_t *csa)
|
|||
|
||||
static int cpio_gzip(FD_t fdo, CSA_t *csa)
|
||||
{
|
||||
CFD_t *cfd = &csa->cpioCfd;
|
||||
FD_t cfd;
|
||||
int rc;
|
||||
const char *failedFile = NULL;
|
||||
|
||||
cfd->cpioIoType = cpioIoTypeGzFd;
|
||||
cfd->cpioGzFd = gzdFdopen(fdDup(fdFileno(fdo)), "w9");
|
||||
cfd = gzdFdopen(fdDup(fdFileno(fdo)), "w9");
|
||||
rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
|
||||
&csa->cpioArchiveSize, &failedFile);
|
||||
if (rc) {
|
||||
|
@ -440,8 +441,7 @@ static int cpio_gzip(FD_t fdo, CSA_t *csa)
|
|||
rc = 1;
|
||||
}
|
||||
|
||||
gzdClose(cfd->cpioGzFd);
|
||||
cfd->cpioGzFd = NULL;
|
||||
Fclose(cfd);
|
||||
if (failedFile)
|
||||
xfree(failedFile);
|
||||
|
||||
|
@ -453,8 +453,8 @@ static int cpio_copy(FD_t fdo, CSA_t *csa)
|
|||
char buf[BUFSIZ];
|
||||
ssize_t nb;
|
||||
|
||||
while((nb = fdRead(csa->cpioFdIn, buf, sizeof(buf))) > 0) {
|
||||
if (fdWrite(fdo, buf, nb) != nb) {
|
||||
while((nb = Fread(buf, sizeof(buf), 1, csa->cpioFdIn)) > 0) {
|
||||
if (Fwrite(buf, nb, 1, fdo) != nb) {
|
||||
rpmError(RPMERR_CPIO, _("cpio_copy write failed: %s"),
|
||||
strerror(errno));
|
||||
return 1;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
extern int noLang; /* XXX FIXME: pass as arg */
|
||||
|
||||
/* These have to be global scope to make up for *stupid* compilers */
|
||||
/*@observer@*/ /*@null@*/ static char *name;
|
||||
/*@observer@*/ /*@null@*/ static char *lang;
|
||||
/*@observer@*/ /*@null@*/ static const char *name = NULL;
|
||||
/*@observer@*/ /*@null@*/ static const char *lang = NULL;
|
||||
|
||||
static struct poptOption optionsTable[] = {
|
||||
{ NULL, 'n', POPT_ARG_STRING, &name, 'n', NULL, NULL},
|
||||
|
@ -22,7 +22,7 @@ int parseDescription(Spec spec)
|
|||
Package pkg;
|
||||
int rc, argc;
|
||||
int arg;
|
||||
char **argv = NULL;
|
||||
const char **argv = NULL;
|
||||
poptContext optCon = NULL;
|
||||
struct spectag *t = NULL;
|
||||
|
||||
|
@ -53,9 +53,8 @@ int parseDescription(Spec spec)
|
|||
}
|
||||
|
||||
if (poptPeekArg(optCon)) {
|
||||
if (! name) {
|
||||
if (name == NULL)
|
||||
name = poptGetArg(optCon);
|
||||
}
|
||||
if (poptPeekArg(optCon)) {
|
||||
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s"),
|
||||
spec->lineNum,
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include "rpmbuild.h"
|
||||
|
||||
/* These have to be global scope to make up for *stupid* compilers */
|
||||
/*@observer@*/ /*@null@*/ static char *name;
|
||||
/*@observer@*/ /*@null@*/ static char *file;
|
||||
/*@observer@*/ /*@null@*/ static const char *name = NULL;
|
||||
/*@observer@*/ /*@null@*/ static const char *file = NULL;
|
||||
static struct poptOption optionsTable[] = {
|
||||
{ NULL, 'n', POPT_ARG_STRING, &name, 'n', NULL, NULL},
|
||||
{ NULL, 'f', POPT_ARG_STRING, &file, 'f', NULL, NULL},
|
||||
|
@ -17,7 +17,7 @@ int parseFiles(Spec spec)
|
|||
Package pkg;
|
||||
int rc, argc;
|
||||
int arg;
|
||||
char **argv = NULL;
|
||||
const char **argv = NULL;
|
||||
int flag = PART_SUBNAME;
|
||||
poptContext optCon = NULL;
|
||||
|
||||
|
@ -47,9 +47,8 @@ int parseFiles(Spec spec)
|
|||
}
|
||||
|
||||
if (poptPeekArg(optCon)) {
|
||||
if (! name) {
|
||||
if (name == NULL)
|
||||
name = poptGetArg(optCon);
|
||||
}
|
||||
if (poptPeekArg(optCon)) {
|
||||
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s"),
|
||||
spec->lineNum,
|
||||
|
|
|
@ -37,7 +37,7 @@ static int requiredTags[] = {
|
|||
static void addOrAppendListEntry(Header h, int_32 tag, char *line)
|
||||
{
|
||||
int argc;
|
||||
char **argv;
|
||||
const char **argv;
|
||||
|
||||
poptParseArgvString(line, &argc, &argv);
|
||||
if (argc) {
|
||||
|
@ -105,7 +105,7 @@ static char *findLastChar(char *s)
|
|||
return res;
|
||||
}
|
||||
|
||||
static int isMemberInEntry(Header header, char *name, int tag)
|
||||
static int isMemberInEntry(Header header, const char *name, int tag)
|
||||
{
|
||||
char **names;
|
||||
int count;
|
||||
|
@ -131,7 +131,7 @@ static int isMemberInEntry(Header header, char *name, int tag)
|
|||
|
||||
static int checkForValidArchitectures(Spec spec)
|
||||
{
|
||||
char *arch, *os;
|
||||
const char *arch, *os;
|
||||
|
||||
rpmGetArchInfo(&arch, NULL);
|
||||
rpmGetOsInfo(&os, NULL);
|
||||
|
@ -244,8 +244,8 @@ static int readIcon(Header h, const char *file)
|
|||
icon = xmalloc(statbuf.st_size);
|
||||
*icon = '\0';
|
||||
fd = fdOpen(fn, O_RDONLY, 0);
|
||||
nb = fdRead(fd, icon, statbuf.st_size);
|
||||
fdClose(fd);
|
||||
nb = Fread(icon, statbuf.st_size, 1, fd);
|
||||
Fclose(fd);
|
||||
if (nb != statbuf.st_size) {
|
||||
rpmError(RPMERR_BADSPEC, _("Unable to read icon: %s"), fn);
|
||||
rc = RPMERR_BADSPEC;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* These have to be global to make up for stupid compilers */
|
||||
static int leaveDirs, skipDefaultAction;
|
||||
static int createDir, quietly;
|
||||
/*@observer@*/ /*@null@*/ static char * dirName;
|
||||
/*@observer@*/ /*@null@*/ static const char * dirName = NULL;
|
||||
static struct poptOption optionsTable[] = {
|
||||
{ NULL, 'a', POPT_ARG_STRING, NULL, 'a', NULL, NULL},
|
||||
{ NULL, 'b', POPT_ARG_STRING, NULL, 'b', NULL, NULL},
|
||||
|
@ -176,9 +176,9 @@ static int doSetupMacro(Spec spec, char *line)
|
|||
StringBuf after;
|
||||
poptContext optCon;
|
||||
int argc;
|
||||
char ** argv;
|
||||
const char ** argv;
|
||||
int arg;
|
||||
char * optArg;
|
||||
const char * optArg;
|
||||
int rc;
|
||||
int num;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "rpmbuild.h"
|
||||
|
||||
static int addTriggerIndex(Package pkg, char *file, char *script, char *prog)
|
||||
static int addTriggerIndex(Package pkg, const char *file, const char *script, const char *prog)
|
||||
{
|
||||
struct TriggerFileEntry *new;
|
||||
struct TriggerFileEntry *list = pkg->triggerFiles;
|
||||
|
@ -36,9 +36,9 @@ static int addTriggerIndex(Package pkg, char *file, char *script, char *prog)
|
|||
}
|
||||
|
||||
/* these have to be global because of stupid compilers */
|
||||
/*@observer@*/ /*@null@*/ static char *name;
|
||||
/*@observer@*/ /*@null@*/ static char *prog;
|
||||
/*@observer@*/ /*@null@*/ static char *file;
|
||||
/*@observer@*/ /*@null@*/ static const char *name = NULL;
|
||||
/*@observer@*/ /*@null@*/ static const char *prog = NULL;
|
||||
/*@observer@*/ /*@null@*/ static const char *file = NULL;
|
||||
static struct poptOption optionsTable[] = {
|
||||
{ NULL, 'p', POPT_ARG_STRING, &prog, 'p', NULL, NULL},
|
||||
{ NULL, 'n', POPT_ARG_STRING, &name, 'n', NULL, NULL},
|
||||
|
@ -61,7 +61,7 @@ int parseScript(Spec spec, int parsePart)
|
|||
/* -f <file> */
|
||||
|
||||
char *p;
|
||||
char **progArgv = NULL;
|
||||
const char **progArgv = NULL;
|
||||
int progArgc;
|
||||
char *partname = NULL;
|
||||
int reqtag = 0;
|
||||
|
@ -76,7 +76,7 @@ int parseScript(Spec spec, int parsePart)
|
|||
|
||||
int rc, argc;
|
||||
int arg;
|
||||
char **argv = NULL;
|
||||
const char **argv = NULL;
|
||||
poptContext optCon = NULL;
|
||||
|
||||
name = NULL;
|
||||
|
@ -175,9 +175,8 @@ int parseScript(Spec spec, int parsePart)
|
|||
}
|
||||
|
||||
if (poptPeekArg(optCon)) {
|
||||
if (! name) {
|
||||
if (name == NULL)
|
||||
name = poptGetArg(optCon);
|
||||
}
|
||||
if (poptPeekArg(optCon)) {
|
||||
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s"),
|
||||
spec->lineNum,
|
||||
|
|
|
@ -159,7 +159,8 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip)
|
|||
|
||||
int readLine(Spec spec, int strip)
|
||||
{
|
||||
char *s, *arch, *os;
|
||||
const char *arch, *os;
|
||||
char *s;
|
||||
int match;
|
||||
struct ReadLevelEntry *rl;
|
||||
OFI_t *ofi = spec->fileStack;
|
||||
|
@ -330,7 +331,7 @@ int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
|
|||
int parsePart = PART_PREAMBLE;
|
||||
int initialPackage = 1;
|
||||
char *name;
|
||||
char *saveArch;
|
||||
const char *saveArch;
|
||||
Package pkg;
|
||||
int x, index;
|
||||
Spec spec;
|
||||
|
@ -439,7 +440,7 @@ int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
|
|||
return RPMERR_BADSPEC;
|
||||
}
|
||||
rpmSetMachine(saveArch, NULL);
|
||||
free(saveArch);
|
||||
xfree(saveArch);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +474,8 @@ int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
|
|||
}
|
||||
|
||||
/* Check for description in each package and add arch and os */
|
||||
{ char *arch, *os, *myos = NULL;
|
||||
{ const char *arch, *os;
|
||||
char *myos = NULL;
|
||||
|
||||
rpmGetArchInfo(&arch, NULL);
|
||||
rpmGetOsInfo(&os, NULL);
|
||||
|
@ -484,8 +486,9 @@ int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
|
|||
* XXX A copy of this string is embedded in headers.
|
||||
*/
|
||||
if (!strcmp(os, "linux")) {
|
||||
os = myos = xstrdup(os);
|
||||
*os = 'L';
|
||||
myos = xstrdup(os);
|
||||
*myos = 'L';
|
||||
os = myos;
|
||||
}
|
||||
|
||||
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
|
||||
|
|
|
@ -90,7 +90,7 @@ struct SpecStruct {
|
|||
|
||||
/*@refcounted@*/ Header buildRestrictions;
|
||||
/*@owned@*/ struct SpecStruct **buildArchitectureSpecs;
|
||||
char ** buildArchitectures;
|
||||
/*@only@*/ const char ** buildArchitectures;
|
||||
int buildArchitectureCount;
|
||||
int inBuildArchitectures;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-I. -I.. -I../build -I../popt -DHAVE_CONFIG_H
|
||||
-I. -I.. -I../build -I../popt -DHAVE_CONFIG_H -D_GNU_SOURCE
|
||||
|
||||
+partial
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ librpm_la_SOURCES = \
|
|||
formats.c fprint.c fs.c ftp.c hash.c header.c install.c \
|
||||
lookup.c macro.c md5.c md5sum.c \
|
||||
messages.c misc.c oldheader.c package.c problems.c query.c \
|
||||
rebuilddb.c rpmbzio.c rpmchecksig.c rpmdb.c rpmerr.c rpminstall.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
|
||||
|
||||
|
|
149
lib/cpio.c
149
lib/cpio.c
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "cpio.h"
|
||||
|
||||
/*@access FD_t@*/
|
||||
|
||||
#define CPIO_NEWC_MAGIC "070701"
|
||||
#define CPIO_CRC_MAGIC "070702"
|
||||
#define TRAILER "TRAILER!!!"
|
||||
|
@ -53,41 +55,15 @@ struct cpioHeader {
|
|||
/*@owned@*/char * path;
|
||||
};
|
||||
|
||||
static inline off_t saferead(CFD_t *cfd, /*@out@*/void * vbuf, size_t amount)
|
||||
static inline off_t saferead(FD_t cfd, /*@out@*/void * vbuf, size_t amount)
|
||||
{
|
||||
off_t rc = 0;
|
||||
char * buf = vbuf;
|
||||
|
||||
while (amount > 0) {
|
||||
size_t nb;
|
||||
switch (cfd->cpioIoType) {
|
||||
default:
|
||||
#ifdef PARANOID
|
||||
fprintf(stderr, "\tsaferead(%p,%p,%x)\n", cfd, vbuf, (unsigned)amount);
|
||||
exit(1);
|
||||
break;
|
||||
#endif
|
||||
case cpioIoTypeDebug:
|
||||
nb = amount;
|
||||
fprintf(stderr, "\tsaferead(%p,%p,%x)\n", cfd, vbuf, (unsigned)amount);
|
||||
break;
|
||||
case cpioIoTypeFd:
|
||||
nb = fdRead(cfd->cpioFd, buf, amount);
|
||||
break;
|
||||
case cpioIoTypeFp:
|
||||
nb = fread(buf, amount, 1, cfd->cpioFp);
|
||||
if (nb)
|
||||
nb *= amount;
|
||||
break;
|
||||
case cpioIoTypeGzFd:
|
||||
nb = gzdRead(cfd->cpioGzFd, buf, amount);
|
||||
break;
|
||||
#if ENABLE_BZIP2_PAYLOAD
|
||||
case cpioIoTypeBzFd:
|
||||
nb = bzdRead(cfd->cpioBzFd, buf, amount);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
nb = Fread(buf, amount, 1, cfd);
|
||||
if (nb <= 0)
|
||||
return nb;
|
||||
rc += nb;
|
||||
|
@ -99,58 +75,32 @@ static inline off_t saferead(CFD_t *cfd, /*@out@*/void * vbuf, size_t amount)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static inline off_t ourread(CFD_t * cfd, /*@out@*/void * buf, size_t size)
|
||||
static inline off_t ourread(FD_t cfd, /*@out@*/void * buf, size_t size)
|
||||
{
|
||||
off_t i = saferead(cfd, buf, size);
|
||||
if (i > 0)
|
||||
cfd->cpioPos += i;
|
||||
cfd->fd_cpioPos += i;
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline void padinfd(CFD_t * cfd, int modulo)
|
||||
static inline void padinfd(FD_t cfd, int modulo)
|
||||
{
|
||||
int buf[10];
|
||||
int amount;
|
||||
|
||||
amount = (modulo - cfd->cpioPos % modulo) % modulo;
|
||||
amount = (modulo - cfd->fd_cpioPos % modulo) % modulo;
|
||||
(void)ourread(cfd, buf, amount);
|
||||
}
|
||||
|
||||
static inline off_t safewrite(CFD_t *cfd, const void * vbuf, size_t amount)
|
||||
static inline off_t safewrite(FD_t cfd, const void * vbuf, size_t amount)
|
||||
{
|
||||
off_t rc = 0;
|
||||
const char * buf = vbuf;
|
||||
|
||||
while (amount > 0) {
|
||||
size_t nb;
|
||||
switch (cfd->cpioIoType) {
|
||||
default:
|
||||
#ifdef PARANOID
|
||||
fprintf(stderr, "\tsafewrite(%p,%p,%x)\n", cfd, vbuf, (unsigned)amount);
|
||||
exit(1);
|
||||
break;
|
||||
#endif
|
||||
case cpioIoTypeDebug:
|
||||
nb = amount;
|
||||
fprintf(stderr, "\tsafewrite(%p,%p,%x)\n", cfd, vbuf, (unsigned)amount);
|
||||
break;
|
||||
case cpioIoTypeFd:
|
||||
nb = fdWrite(cfd->cpioFd, buf, amount);
|
||||
break;
|
||||
case cpioIoTypeFp:
|
||||
nb = fwrite(buf, amount, 1, cfd->cpioFp);
|
||||
if (nb)
|
||||
nb *= amount;
|
||||
break;
|
||||
case cpioIoTypeGzFd:
|
||||
nb = gzdWrite(cfd->cpioGzFd, buf, amount);
|
||||
break;
|
||||
#if ENABLE_BZIP2_PAYLOAD
|
||||
case cpioIoTypeBzFd:
|
||||
nb = bzdWrite(cfd->cpioBzFd, buf, amount);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
nb = Fwrite(buf, amount, 1, cfd);
|
||||
if (nb <= 0)
|
||||
return nb;
|
||||
rc += nb;
|
||||
|
@ -163,7 +113,7 @@ static inline off_t safewrite(CFD_t *cfd, const void * vbuf, size_t amount)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static inline int padoutfd(CFD_t * cfd, size_t * where, int modulo)
|
||||
static inline int padoutfd(FD_t cfd, size_t * where, int modulo)
|
||||
{
|
||||
static int buf[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int amount;
|
||||
|
@ -201,7 +151,7 @@ static int strntoul(const char *str, /*@out@*/char **endptr, int base, int num)
|
|||
sprintf(space, "%8.8lx", (unsigned long) (val)); \
|
||||
memcpy(phys, space, 8);
|
||||
|
||||
static int getNextHeader(CFD_t * cfd, struct cpioHeader * chPtr)
|
||||
static int getNextHeader(FD_t cfd, /*@out@*/ struct cpioHeader * chPtr)
|
||||
{
|
||||
struct cpioCrcPhysicalHeader physHeader;
|
||||
int nameSize;
|
||||
|
@ -366,15 +316,15 @@ static int checkDirectory(const char * filename)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int expandRegular(CFD_t * cfd, struct cpioHeader * hdr,
|
||||
static int expandRegular(FD_t cfd, struct cpioHeader * hdr,
|
||||
cpioCallback cb, void * cbData)
|
||||
{
|
||||
FD_t out;
|
||||
FD_t ofd;
|
||||
char buf[8192];
|
||||
int bytesRead;
|
||||
int left = hdr->size;
|
||||
int rc = 0;
|
||||
struct cpioCallbackInfo cbInfo;
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
struct stat sb;
|
||||
|
||||
/* Rename the old file before attempting unlink to avoid EBUSY errors */
|
||||
|
@ -396,8 +346,8 @@ static int expandRegular(CFD_t * cfd, struct cpioHeader * hdr,
|
|||
}
|
||||
}
|
||||
|
||||
out = fdOpen(hdr->path, O_CREAT | O_WRONLY, 0);
|
||||
if (fdFileno(out) < 0)
|
||||
ofd = fdOpen(hdr->path, O_CREAT | O_WRONLY, 0);
|
||||
if (fdFileno(ofd) < 0)
|
||||
return CPIOERR_OPEN_FAILED;
|
||||
|
||||
cbInfo.file = hdr->path;
|
||||
|
@ -410,7 +360,7 @@ static int expandRegular(CFD_t * cfd, struct cpioHeader * hdr,
|
|||
break;
|
||||
}
|
||||
|
||||
if (fdWrite(out, buf, bytesRead) != bytesRead) {
|
||||
if (Fwrite(buf, bytesRead, 1, ofd) != bytesRead) {
|
||||
rc = CPIOERR_COPY_FAILED;
|
||||
break;
|
||||
}
|
||||
|
@ -420,17 +370,17 @@ static int expandRegular(CFD_t * cfd, struct cpioHeader * hdr,
|
|||
/* don't call this with fileSize == fileComplete */
|
||||
if (!rc && cb && left) {
|
||||
cbInfo.fileComplete = hdr->size - left;
|
||||
cbInfo.bytesProcessed = cfd->cpioPos;
|
||||
cbInfo.bytesProcessed = cfd->fd_cpioPos;
|
||||
cb(&cbInfo, cbData);
|
||||
}
|
||||
}
|
||||
|
||||
fdClose(out);
|
||||
Fclose(ofd);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int expandSymlink(CFD_t * cfd, struct cpioHeader * hdr)
|
||||
static int expandSymlink(FD_t cfd, struct cpioHeader * hdr)
|
||||
{
|
||||
char buf[2048], buf2[2048];
|
||||
struct stat sb;
|
||||
|
@ -463,7 +413,7 @@ static int expandSymlink(CFD_t * cfd, struct cpioHeader * hdr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int expandFifo( /*@unused@*/ CFD_t * cfd, struct cpioHeader * hdr)
|
||||
static int expandFifo( /*@unused@*/ FD_t cfd, struct cpioHeader * hdr)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
|
@ -480,7 +430,7 @@ static int expandFifo( /*@unused@*/ CFD_t * cfd, struct cpioHeader * hdr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int expandDevice( /*@unused@*/ CFD_t * cfd, struct cpioHeader * hdr)
|
||||
static int expandDevice( /*@unused@*/ FD_t cfd, struct cpioHeader * hdr)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
|
@ -541,7 +491,7 @@ static int createLinks(struct hardLink * li, /*@out@*/const char ** failedFile)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int eatBytes(CFD_t * cfd, int amount)
|
||||
static int eatBytes(FD_t cfd, int amount)
|
||||
{
|
||||
char buf[4096];
|
||||
int bite;
|
||||
|
@ -556,7 +506,7 @@ static int eatBytes(CFD_t * cfd, int amount)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
||||
int cpioInstallArchive(FD_t cfd, struct cpioFileMapping * mappings,
|
||||
int numMappings, cpioCallback cb, void * cbData,
|
||||
const char ** failedFile)
|
||||
{
|
||||
|
@ -567,11 +517,11 @@ int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
|||
struct cpioFileMapping needle;
|
||||
mode_t cpioMode;
|
||||
int olderr;
|
||||
struct cpioCallbackInfo cbInfo;
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
struct hardLink * links = NULL;
|
||||
struct hardLink * li = NULL;
|
||||
|
||||
cfd->cpioPos = 0;
|
||||
cfd->fd_cpioPos = 0;
|
||||
if (failedFile)
|
||||
*failedFile = NULL;
|
||||
|
||||
|
@ -585,7 +535,7 @@ int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
|||
}
|
||||
|
||||
if (!strcmp(ch.path, TRAILER)) {
|
||||
free(ch.path);
|
||||
if (ch.path) free(ch.path);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -602,7 +552,7 @@ int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
|||
|
||||
if (map) {
|
||||
if (map->mapFlags & CPIO_MAP_PATH) {
|
||||
free(ch.path);
|
||||
if (ch.path) free(ch.path);
|
||||
ch.path = xstrdup(map->fsPath);
|
||||
}
|
||||
|
||||
|
@ -699,11 +649,11 @@ int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
|||
cbInfo.file = ch.path;
|
||||
cbInfo.fileSize = ch.size;
|
||||
cbInfo.fileComplete = ch.size;
|
||||
cbInfo.bytesProcessed = cfd->cpioPos;
|
||||
cbInfo.bytesProcessed = cfd->fd_cpioPos;
|
||||
cb(&cbInfo, cbData);
|
||||
}
|
||||
|
||||
free(ch.path);
|
||||
if (ch.path) free(ch.path);
|
||||
ch.path = NULL;
|
||||
} while (1 && !rc);
|
||||
|
||||
|
@ -736,7 +686,7 @@ int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int writeFile(CFD_t *cfd, struct stat sb, struct cpioFileMapping * map,
|
||||
static int writeFile(FD_t cfd, struct stat sb, struct cpioFileMapping * map,
|
||||
/*@out@*/size_t * sizep, int writeData)
|
||||
{
|
||||
struct cpioCrcPhysicalHeader hdr;
|
||||
|
@ -825,11 +775,12 @@ static int writeFile(CFD_t *cfd, struct stat sb, struct cpioFileMapping * map,
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
amount = fdRead(datafd, b,
|
||||
sb.st_size > sizeof(buf) ? sizeof(buf) : sb.st_size);
|
||||
amount = Fread(b,
|
||||
(sb.st_size > sizeof(buf) ? sizeof(buf) : sb.st_size),
|
||||
1, datafd);
|
||||
if (amount <= 0) {
|
||||
olderrno = errno;
|
||||
fdClose(datafd);
|
||||
Fclose(datafd);
|
||||
errno = olderrno;
|
||||
return CPIOERR_READ_FAILED;
|
||||
}
|
||||
|
@ -837,7 +788,7 @@ static int writeFile(CFD_t *cfd, struct stat sb, struct cpioFileMapping * map,
|
|||
|
||||
if ((rc = safewrite(cfd, b, amount)) != amount) {
|
||||
olderrno = errno;
|
||||
fdClose(datafd);
|
||||
Fclose(datafd);
|
||||
errno = olderrno;
|
||||
return rc;
|
||||
}
|
||||
|
@ -851,7 +802,7 @@ static int writeFile(CFD_t *cfd, struct stat sb, struct cpioFileMapping * map,
|
|||
}
|
||||
#endif
|
||||
|
||||
fdClose(datafd);
|
||||
Fclose(datafd);
|
||||
} else if (writeData && S_ISLNK(sb.st_mode)) {
|
||||
if ((rc = safewrite(cfd, symbuf, amount)) != amount)
|
||||
return rc;
|
||||
|
@ -868,7 +819,7 @@ static int writeFile(CFD_t *cfd, struct stat sb, struct cpioFileMapping * map,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int writeLinkedFile(CFD_t *cfd, struct hardLink * hlink,
|
||||
static int writeLinkedFile(FD_t cfd, struct hardLink * hlink,
|
||||
struct cpioFileMapping * mappings,
|
||||
cpioCallback cb, void * cbData,
|
||||
/*@out@*/size_t * sizep,
|
||||
|
@ -876,7 +827,7 @@ static int writeLinkedFile(CFD_t *cfd, struct hardLink * hlink,
|
|||
{
|
||||
int i, rc;
|
||||
size_t size, total;
|
||||
struct cpioCallbackInfo cbinfo;
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
|
||||
total = 0;
|
||||
|
||||
|
@ -891,8 +842,8 @@ static int writeLinkedFile(CFD_t *cfd, struct hardLink * hlink,
|
|||
total += size;
|
||||
|
||||
if (cb) {
|
||||
cbinfo.file = mappings[i].archivePath;
|
||||
cb(&cbinfo, cbData);
|
||||
cbInfo.file = mappings[i].archivePath;
|
||||
cb(&cbInfo, cbData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -911,21 +862,21 @@ static int writeLinkedFile(CFD_t *cfd, struct hardLink * hlink,
|
|||
*sizep = total;
|
||||
|
||||
if (cb) {
|
||||
cbinfo.file = mappings[i].archivePath;
|
||||
cb(&cbinfo, cbData);
|
||||
cbInfo.file = mappings[i].archivePath;
|
||||
cb(&cbInfo, cbData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpioBuildArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
||||
int cpioBuildArchive(FD_t cfd, struct cpioFileMapping * mappings,
|
||||
int numMappings, cpioCallback cb, void * cbData,
|
||||
unsigned int * archiveSize, const char ** failedFile)
|
||||
{
|
||||
size_t size, totalsize = 0;
|
||||
int rc;
|
||||
int i;
|
||||
struct cpioCallbackInfo cbinfo;
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
struct cpioCrcPhysicalHeader hdr;
|
||||
struct stat sb;
|
||||
/*@-fullinitblock@*/
|
||||
|
@ -989,8 +940,8 @@ int cpioBuildArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
|||
}
|
||||
|
||||
if (cb) {
|
||||
cbinfo.file = mappings[i].archivePath;
|
||||
cb(&cbinfo, cbData);
|
||||
cbInfo.file = mappings[i].archivePath;
|
||||
cb(&cbInfo, cbData);
|
||||
}
|
||||
|
||||
totalsize += size;
|
||||
|
|
29
lib/cpio.h
29
lib/cpio.h
|
@ -61,31 +61,6 @@ struct cpioCallbackInfo {
|
|||
long bytesProcessed; /* bytes in archive read */
|
||||
};
|
||||
|
||||
typedef struct CFD {
|
||||
union {
|
||||
/*@owned@*/FD_t _cfdu_fd;
|
||||
#define cpioFd _cfdu._cfdu_fd
|
||||
/*@owned@*/FILE *_cfdu_fp;
|
||||
#define cpioFp _cfdu._cfdu_fp
|
||||
/*@owned@*/FD_t _cfdu_gzfd;
|
||||
#define cpioGzFd _cfdu._cfdu_gzfd
|
||||
#if ENABLE_BZIP2_PAYLOAD
|
||||
/*@owned@*/FD_t _cfdu_bzfd;
|
||||
#define cpioBzFd _cfdu._cfdu_bzfd
|
||||
#endif
|
||||
} _cfdu;
|
||||
int cpioPos;
|
||||
enum cpioIoType {
|
||||
cpioIoTypeDebug,
|
||||
cpioIoTypeFd,
|
||||
cpioIoTypeFp,
|
||||
cpioIoTypeGzFd,
|
||||
#if ENABLE_BZIP2_PAYLOAD
|
||||
cpioIoTypeBzFd,
|
||||
#endif
|
||||
} cpioIoType;
|
||||
} CFD_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -99,10 +74,10 @@ typedef void (*cpioCallback)(struct cpioCallbackInfo * filespec, void * data);
|
|||
directory. The mode mapping is only used for the permission bits, not
|
||||
for the file type. The owner/group mappings are ignored for the nonroot
|
||||
user. If *failedFile is non-NULL on return, it should be free()d. */
|
||||
int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
||||
int cpioInstallArchive(FD_t cfd, struct cpioFileMapping * mappings,
|
||||
int numMappings, cpioCallback cb, void * cbData,
|
||||
/*@out@*/const char ** failedFile);
|
||||
int cpioBuildArchive(CFD_t *cfd, struct cpioFileMapping * mappings,
|
||||
int cpioBuildArchive(FD_t cfd, struct cpioFileMapping * mappings,
|
||||
int numMappings, cpioCallback cb, void * cbData,
|
||||
unsigned int * archiveSize, /*@out@*/const char ** failedFile);
|
||||
|
||||
|
|
88
lib/falloc.c
88
lib/falloc.c
|
@ -35,24 +35,23 @@ struct faFooter {
|
|||
} ;
|
||||
|
||||
FD_t faFileno(faFile fa) {
|
||||
return fa->fd;
|
||||
return fa;
|
||||
}
|
||||
|
||||
static inline ssize_t faRead(faFile fa, /*@out@*/void *buf, size_t count) {
|
||||
return fdRead(faFileno(fa), buf, count);
|
||||
static inline ssize_t faRead(faFile fa, /*@out@*/ void *buf, size_t count) {
|
||||
return Fread(buf, count, 1, faFileno(fa));
|
||||
}
|
||||
|
||||
static inline ssize_t faWrite(faFile fa, const void *buf, size_t count) {
|
||||
return fdWrite(faFileno(fa), buf, count);
|
||||
return Fwrite(buf, count, 1, faFileno(fa));
|
||||
}
|
||||
|
||||
off_t faLseek(faFile fa, off_t off, int op) {
|
||||
return fdLseek(faFileno(fa), off, op);
|
||||
int faSeek(faFile fa, off_t pos, int whence) {
|
||||
return Fseek(faFileno(fa), pos, whence);
|
||||
}
|
||||
|
||||
void faClose(faFile fa) {
|
||||
fdClose(fa->fd);
|
||||
free(fa);
|
||||
int faClose(faFile fa) {
|
||||
return Fclose(faFileno(fa));
|
||||
}
|
||||
|
||||
int faFcntl(faFile fa, int op, void *lip) {
|
||||
|
@ -60,13 +59,13 @@ int faFcntl(faFile fa, int op, void *lip) {
|
|||
}
|
||||
|
||||
static inline ssize_t faPRead(faFile fa, /*@out@*/void *buf, size_t count, off_t offset) {
|
||||
if (faLseek(fa, offset, SEEK_SET) < 0)
|
||||
if (faSeek(fa, offset, SEEK_SET) < 0)
|
||||
return -1;
|
||||
return faRead(fa, buf, count);
|
||||
}
|
||||
|
||||
static inline ssize_t faPWrite(faFile fa, const void *buf, size_t count, off_t offset) {
|
||||
if (faLseek(fa, offset, SEEK_SET) < 0)
|
||||
if (faSeek(fa, offset, SEEK_SET) < 0)
|
||||
return -1;
|
||||
return faWrite(fa, buf, count);
|
||||
}
|
||||
|
@ -75,59 +74,43 @@ static inline ssize_t faPWrite(faFile fa, const void *buf, size_t count, off_t o
|
|||
faFile faOpen(const char * path, int flags, int perms)
|
||||
{
|
||||
struct faFileHeader newHdr;
|
||||
struct faFile_s fas;
|
||||
faFile fa;
|
||||
off_t end;
|
||||
|
||||
if (flags & O_WRONLY) {
|
||||
if (flags & O_WRONLY)
|
||||
return NULL;
|
||||
}
|
||||
if (flags & O_RDWR) {
|
||||
fas.readOnly = 0;
|
||||
} else {
|
||||
fas.readOnly = 1;
|
||||
}
|
||||
|
||||
fas.fd = fdOpen(path, flags, perms);
|
||||
if (fdFileno(fas.fd) < 0) return NULL;
|
||||
fas.firstFree = 0;
|
||||
fas.fileSize = 0;
|
||||
fa = fdOpen(path, flags, perms);
|
||||
if (fdFileno(faFileno(fa)) < 0)
|
||||
return NULL;
|
||||
|
||||
fa->readOnly = (flags & O_RDWR) ? 0 : 1;
|
||||
fa->firstFree = 0;
|
||||
|
||||
/* is this file brand new? */
|
||||
end = faLseek(&fas, 0, SEEK_END);
|
||||
if (!end) {
|
||||
if ((fa->fileSize = faSeek(fa, 0, SEEK_END)) < 0) {
|
||||
newHdr.magic = FA_MAGIC;
|
||||
newHdr.firstFree = 0;
|
||||
if (faWrite(&fas, &newHdr, sizeof(newHdr)) != sizeof(newHdr)) {
|
||||
close(fdFileno(fas.fd));
|
||||
if (faWrite(fa, &newHdr, sizeof(newHdr)) != sizeof(newHdr)) {
|
||||
faClose(fa);
|
||||
return NULL;
|
||||
}
|
||||
fas.firstFree = 0;
|
||||
fas.fileSize = sizeof(newHdr);
|
||||
fa->firstFree = 0;
|
||||
fa->fileSize = sizeof(newHdr);
|
||||
} else {
|
||||
if (faPRead(&fas, &newHdr, sizeof(newHdr), 0) != sizeof(newHdr)) {
|
||||
fdClose(fas.fd);
|
||||
if (faPRead(fa, &newHdr, sizeof(newHdr), 0) != sizeof(newHdr)) {
|
||||
faClose(fa);
|
||||
return NULL;
|
||||
}
|
||||
if (newHdr.magic != FA_MAGIC) {
|
||||
fdClose(fas.fd);
|
||||
faClose(fa);
|
||||
return NULL;
|
||||
}
|
||||
fas.firstFree = newHdr.firstFree;
|
||||
fa->firstFree = newHdr.firstFree;
|
||||
|
||||
if (faLseek(&fas, 0, SEEK_END) < 0) {
|
||||
fdClose(fas.fd);
|
||||
if ((fa->fileSize = faSeek(fa, 0, SEEK_END)) < 0) {
|
||||
faClose(fa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fas.fileSize = faLseek(&fas, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
if ((fa = malloc(sizeof(*fa))) != NULL) {
|
||||
fa->fd = fas.fd;
|
||||
fa->readOnly = fas.readOnly;
|
||||
fa->firstFree = fas.firstFree;
|
||||
fa->fileSize = fas.fileSize;
|
||||
}
|
||||
|
||||
return fa;
|
||||
|
@ -298,7 +281,8 @@ unsigned int faAlloc(faFile fa, unsigned int size)
|
|||
footerOffset = newBlockOffset + size - sizeof(footer);
|
||||
|
||||
space = alloca(size);
|
||||
if (!space) return 0;
|
||||
if (space == NULL) return 0;
|
||||
memset(space, 0, size);
|
||||
|
||||
footer.isFree = header.isFree = 0;
|
||||
footer.size = header.size = size;
|
||||
|
@ -410,16 +394,16 @@ int faNextOffset(faFile fa, unsigned int lastOffset)
|
|||
struct faHeader header;
|
||||
int offset;
|
||||
|
||||
if (lastOffset) {
|
||||
offset = lastOffset - sizeof(header);
|
||||
} else {
|
||||
offset = sizeof(struct faFileHeader);
|
||||
}
|
||||
offset = (lastOffset)
|
||||
? (lastOffset - sizeof(header))
|
||||
: sizeof(struct faFileHeader);
|
||||
|
||||
if (offset >= fa->fileSize) return 0;
|
||||
if (offset >= fa->fileSize)
|
||||
return 0;
|
||||
|
||||
if (faPRead(fa, &header, sizeof(header), offset) != sizeof(header))
|
||||
return 0;
|
||||
|
||||
if (!lastOffset && !header.isFree)
|
||||
return (offset + sizeof(header));
|
||||
|
||||
|
|
12
lib/falloc.h
12
lib/falloc.h
|
@ -5,16 +5,15 @@
|
|||
are compacted. Minimal fragmentation is more important then speed. This
|
||||
uses 32 bit offsets on all platforms and should be byte order independent */
|
||||
|
||||
#if 0
|
||||
typedef /*@abstract@*/ struct faFile_s {
|
||||
/*@owned@*/ FD_t fd;
|
||||
int readOnly;
|
||||
unsigned int firstFree;
|
||||
unsigned long fileSize;
|
||||
} * faFile;
|
||||
|
||||
#ifdef UNUSED
|
||||
struct FaPlace_s;
|
||||
typedef struct FaPlace * faPlace;
|
||||
#else
|
||||
typedef FD_t faFile;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -25,10 +24,11 @@ extern "C" {
|
|||
/*@only@*/ faFile faOpen(const char * path, int flags, int perms);
|
||||
unsigned int faAlloc(faFile fa, unsigned int size); /* returns 0 on failure */
|
||||
void faFree(faFile fa, unsigned int offset);
|
||||
void faClose( /*@only@*/ faFile fa);
|
||||
|
||||
FD_t faFileno(faFile fa);
|
||||
off_t faLseek(faFile fa, off_t off, int op);
|
||||
int faSeek(faFile fa, off_t pos, int whence);
|
||||
int faClose( /*@only@*/ faFile fa);
|
||||
|
||||
int faFcntl(faFile fa, int op, void *lip);
|
||||
|
||||
int faFirstOffset(faFile fa);
|
||||
|
|
48
lib/fprint.c
48
lib/fprint.c
|
@ -17,23 +17,23 @@ void fpCacheFree(fingerPrintCache cache) {
|
|||
|
||||
static const struct fprintCacheEntry_s * cacheContainsDirectory(
|
||||
fingerPrintCache cache,
|
||||
const char * dirName) {
|
||||
const char * dirName)
|
||||
{
|
||||
const void ** data;
|
||||
int count;
|
||||
|
||||
if (htGetEntry(cache->ht, dirName, &data, &count, NULL)) return NULL;
|
||||
if (htGetEntry(cache->ht, dirName, &data, NULL, NULL))
|
||||
return NULL;
|
||||
return data[0];
|
||||
}
|
||||
|
||||
static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
|
||||
const char * baseName, int scareMemory) {
|
||||
const char * baseName, int scareMemory)
|
||||
{
|
||||
char dir[PATH_MAX];
|
||||
const char * chptr1;
|
||||
char * end, * bn;
|
||||
char * end;
|
||||
fingerPrint fp;
|
||||
struct stat sb;
|
||||
char * buf;
|
||||
int stripCount;
|
||||
const struct fprintCacheEntry_s * cacheHit;
|
||||
struct fprintCacheEntry_s * newEntry;
|
||||
|
||||
|
@ -54,7 +54,7 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
|
|||
if ( /*@-unrecog@*/ realpath(".", dir) /*@=unrecog@*/ != NULL) {
|
||||
char *s = alloca(strlen(dir) + strlen(dirName) + 2);
|
||||
sprintf(s, "%s/%s", dir, dirName);
|
||||
dirName = chptr1 = s;
|
||||
dirName = s;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,12 +63,9 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
|
|||
|
||||
buf = alloca(strlen(dirName) + 1);
|
||||
strcpy(buf, dirName);
|
||||
end = bn = strrchr(buf, '/');
|
||||
stripCount = 0;
|
||||
end = buf + strlen(buf);
|
||||
fp.entry = NULL;
|
||||
while (*buf) {
|
||||
*end = '\0';
|
||||
stripCount++;
|
||||
|
||||
/* as we're stating paths here, we want to follow symlinks */
|
||||
|
||||
|
@ -87,11 +84,13 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
|
|||
}
|
||||
|
||||
if (fp.entry) {
|
||||
chptr1 = dirName + (end - buf) + 1;
|
||||
if (scareMemory)
|
||||
fp.subdir = chptr1;
|
||||
fp.subdir = dirName + (end - buf);
|
||||
if (fp.subdir[0] == '/' && fp.subdir[1] != '\0')
|
||||
fp.subdir++;
|
||||
else
|
||||
fp.subdir = xstrdup(chptr1); /* XXX memory leak, but how
|
||||
fp.subdir = "";
|
||||
if (!scareMemory && fp.subdir != NULL)
|
||||
fp.subdir = xstrdup(fp.subdir); /* XXX memory leak, but how
|
||||
do we know we can free it?
|
||||
Using the (new) cache would
|
||||
work if hash tables allowed
|
||||
|
@ -102,6 +101,7 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
|
|||
|
||||
end--;
|
||||
while ((end > buf) && *end != '/') end--;
|
||||
*end = '\0';
|
||||
}
|
||||
|
||||
/* This can't happen, or stat('/') just failed! */
|
||||
|
@ -113,8 +113,15 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
|
|||
|
||||
fingerPrint fpLookup(fingerPrintCache cache, const char * fullName,
|
||||
int scareMemory) {
|
||||
/* XXX FIXME */
|
||||
abort();
|
||||
char *dn = strcpy(alloca(strlen(fullName)+1), fullName);
|
||||
char *bn = strrchr(dn, '/');
|
||||
|
||||
if (bn)
|
||||
*bn++ = '\0';
|
||||
else
|
||||
bn = dn;
|
||||
|
||||
return doLookup(cache, dn, bn, scareMemory);
|
||||
}
|
||||
|
||||
unsigned int fpHashFunction(const void * key)
|
||||
|
@ -137,7 +144,10 @@ unsigned int fpHashFunction(const void * key)
|
|||
|
||||
int fpEqual(const void * key1, const void * key2)
|
||||
{
|
||||
return FP_EQUAL(*((const fingerPrint *) key1), *((fingerPrint *) key2));
|
||||
const fingerPrint *k1 = key1;
|
||||
const fingerPrint *k2 = key2;
|
||||
/* XXX negated to preserve strcmp return behavior in ht->eq */
|
||||
return (FP_EQUAL(*k1, *k2) ? 0 : 1);
|
||||
}
|
||||
|
||||
void fpLookupList(fingerPrintCache cache, const char ** dirNames,
|
||||
|
|
14
lib/ftp.c
14
lib/ftp.c
|
@ -456,13 +456,13 @@ static int copyData( /*@only@*/ FD_t sfd, FD_t tfd) {
|
|||
break;
|
||||
}
|
||||
|
||||
bytesRead = fdRead(sfd, buf, sizeof(buf));
|
||||
bytesRead = Fread(buf, sizeof(buf), 1, sfd);
|
||||
if (bytesRead == 0) {
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (fdWrite(tfd, buf, bytesRead) != bytesRead) {
|
||||
if (Fwrite(buf, bytesRead, 1, tfd) != bytesRead) {
|
||||
rc = FTPERR_FILE_IO_ERROR;
|
||||
break;
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ fprintf(stderr, "++ copied %d bytes: %s\n", bytesCopied, ftpStrerror(rc));
|
|||
bytesCopied, bytesCopied, NULL, urlNotifyData);
|
||||
}
|
||||
|
||||
fdClose(sfd);
|
||||
Fclose(sfd);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ fprintf(stderr, "-> ABOR\n");
|
|||
ftpTimeoutSecs = tosecs;
|
||||
|
||||
if (fdFileno(fd) >= 0)
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,7 @@ fprintf(stderr, "-> PASV\n");
|
|||
sizeof(dataAddress)) < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
return FTPERR_FAILED_DATA_CONNECT;
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ fprintf(stderr, "-> %s", retrCommand);
|
|||
}
|
||||
|
||||
if ((rc = ftpCheckResponse(u, NULL))) {
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ int ftpGetFile(FD_t sfd, FD_t tfd)
|
|||
|
||||
/* XXX normally sfd = ufdOpen(...) and this code does not execute */
|
||||
if (fdFileno(sfd) < 0 && (rc = ftpGetFileDesc(sfd)) < 0) {
|
||||
fdClose(sfd);
|
||||
Fclose(sfd);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
28
lib/hash.c
28
lib/hash.c
|
@ -24,9 +24,9 @@ static /*@shared@*/ struct hashBucket * findEntry(hashTable ht, const void * key
|
|||
struct hashBucket * b;
|
||||
|
||||
hash = ht->fn(key) % ht->numBuckets;
|
||||
b = ht->buckets[hash];
|
||||
b = ht->buckets[hash];
|
||||
|
||||
while (b && b->key && !ht->eq(b->key, key))
|
||||
while (b && b->key && ht->eq(b->key, key))
|
||||
b = b->next;
|
||||
|
||||
return b;
|
||||
|
@ -74,15 +74,15 @@ hashTable htCreate(int numBuckets, int keySize, hashFunctionType fn,
|
|||
void htAddEntry(hashTable ht, const void * key, const void * data)
|
||||
{
|
||||
unsigned int hash;
|
||||
struct hashBucket * b, * ob;
|
||||
struct hashBucket * b;
|
||||
|
||||
hash = ht->fn(key) % ht->numBuckets;
|
||||
b = ob = ht->buckets[hash];
|
||||
b = ht->buckets[hash];
|
||||
|
||||
while (b && b->key && !ht->eq(b->key, key))
|
||||
while (b && b->key && ht->eq(b->key, key))
|
||||
b = b->next;
|
||||
|
||||
if (!b) {
|
||||
|
||||
if (b == NULL) {
|
||||
b = xmalloc(sizeof(*b));
|
||||
if (ht->keySize) {
|
||||
char *k = xmalloc(ht->keySize);
|
||||
|
@ -128,16 +128,20 @@ int htHasEntry(hashTable ht, const void * key)
|
|||
if (!(b = findEntry(ht, key))) return 0; else return 1;
|
||||
}
|
||||
|
||||
int htGetEntry(hashTable ht, const void * key, const void *** data,
|
||||
int htGetEntry(hashTable ht, const void * key, const void *** data,
|
||||
int * dataCount, const void ** tableKey)
|
||||
{
|
||||
struct hashBucket * b;
|
||||
|
||||
if (!(b = findEntry(ht, key))) return 1;
|
||||
if ((b = findEntry(ht, key)) == NULL)
|
||||
return 1;
|
||||
|
||||
*data = b->data;
|
||||
*dataCount = b->dataCount;
|
||||
if (tableKey) *tableKey = b->key;
|
||||
if (data)
|
||||
*data = b->data;
|
||||
if (dataCount)
|
||||
*dataCount = b->dataCount;
|
||||
if (tableKey)
|
||||
*tableKey = b->key;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
28
lib/header.c
28
lib/header.c
|
@ -482,20 +482,20 @@ int headerWrite(FD_t fd, Header h, int magicp)
|
|||
p = doHeaderUnload(h, &length);
|
||||
|
||||
if (magicp) {
|
||||
nb = fdWrite(fd, header_magic, sizeof(header_magic));
|
||||
nb = Fwrite(header_magic, sizeof(header_magic), 1, fd);
|
||||
if (nb != sizeof(header_magic)) {
|
||||
free(p);
|
||||
return 1;
|
||||
}
|
||||
l = htonl(0);
|
||||
nb = fdWrite(fd, &l, sizeof(l));
|
||||
nb = Fwrite(&l, sizeof(l), 1, fd);
|
||||
if (nb != sizeof(l)) {
|
||||
free(p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
nb = fdWrite(fd, p, length);
|
||||
nb = Fwrite(p, length, 1, fd);
|
||||
if (nb != length) {
|
||||
free(p);
|
||||
return 1;
|
||||
|
@ -571,20 +571,20 @@ int headerGzWrite(FD_t fd, Header h, int magicp)
|
|||
p = doHeaderUnload(h, &length);
|
||||
|
||||
if (magicp) {
|
||||
nb = gzdWrite(fd, header_magic, sizeof(header_magic));
|
||||
nb = Fwrite(header_magic, sizeof(header_magic), 1, fd);
|
||||
if (nb != sizeof(header_magic)) {
|
||||
free(p);
|
||||
return 1;
|
||||
}
|
||||
l = htonl(0);
|
||||
nb = gzdWrite(fd, &l, sizeof(l));
|
||||
nb = Fwrite(&l, sizeof(l), 1, fd);
|
||||
if (nb != sizeof(l)) {
|
||||
free(p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
nb = gzdWrite(fd, p, length);
|
||||
nb = Fwrite(p, length, 1, fd);
|
||||
if (nb != length) {
|
||||
free(p);
|
||||
return 1;
|
||||
|
@ -605,24 +605,24 @@ Header headerGzRead(FD_t fd, int magicp)
|
|||
int totalSize;
|
||||
|
||||
if (magicp == HEADER_MAGIC_YES) {
|
||||
if (gzdRead(fd, &magic, sizeof(magic)) != sizeof(magic))
|
||||
if (Fread(&magic, sizeof(magic), 1, fd) != sizeof(magic))
|
||||
return NULL;
|
||||
if (memcmp(&magic, header_magic, sizeof(magic))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (gzdRead(fd, &reserved, sizeof(reserved)) != sizeof(reserved))
|
||||
if (Fread(&reserved, sizeof(reserved), 1, fd) != sizeof(reserved))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* First read the index length (count of index entries) */
|
||||
if (gzdRead(fd, &il, sizeof(il)) != sizeof(il))
|
||||
if (Fread(&il, sizeof(il), 1, fd) != sizeof(il))
|
||||
return NULL;
|
||||
|
||||
il = ntohl(il);
|
||||
|
||||
/* Then read the data length (number of bytes) */
|
||||
if (gzdRead(fd, &dl, sizeof(dl)) != sizeof(dl))
|
||||
if (Fread(&dl, sizeof(dl), 1, fd) != sizeof(dl))
|
||||
return NULL;
|
||||
|
||||
dl = ntohl(dl);
|
||||
|
@ -635,7 +635,7 @@ Header headerGzRead(FD_t fd, int magicp)
|
|||
*p++ = htonl(dl);
|
||||
|
||||
totalSize -= sizeof(int_32) + sizeof(int_32);
|
||||
if (gzdRead(fd, p, totalSize) != totalSize)
|
||||
if (Fread(p, totalSize, 1, fd) != totalSize)
|
||||
return NULL;
|
||||
|
||||
h = headerLoad(block);
|
||||
|
@ -1163,11 +1163,11 @@ headerGetLangs(Header h)
|
|||
return table;
|
||||
}
|
||||
|
||||
int headerAddI18NString(Header h, int_32 tag, char * string, char * lang)
|
||||
int headerAddI18NString(Header h, int_32 tag, const char * string, const char * lang)
|
||||
{
|
||||
struct indexEntry * table, * entry;
|
||||
char * chptr;
|
||||
char ** strArray;
|
||||
const char ** strArray;
|
||||
int length;
|
||||
int ghosts;
|
||||
int i, langNum;
|
||||
|
@ -1181,7 +1181,7 @@ int headerAddI18NString(Header h, int_32 tag, char * string, char * lang)
|
|||
}
|
||||
|
||||
if (!table && !entry) {
|
||||
char * charArray[2];
|
||||
const char * charArray[2];
|
||||
int count = 0;
|
||||
if (!lang || (lang[0] == 'C' && lang[1] == '\0')) {
|
||||
charArray[count++] = "C";
|
||||
|
|
|
@ -124,7 +124,8 @@ char **headerGetLangs(Header h);
|
|||
more fine grained control use headerAddEntry() and headerModifyEntry()
|
||||
but be careful!
|
||||
*/
|
||||
int headerAddI18NString(Header h, int_32 tag, char * string, char * lang);
|
||||
int headerAddI18NString(Header h, int_32 tag, const char * string,
|
||||
const char * lang);
|
||||
|
||||
/* Appends item p to entry w/ tag and type as passed. Won't work on
|
||||
RPM_STRING_TYPE. Any pointers from headerGetEntry() for this entry
|
||||
|
|
|
@ -301,6 +301,7 @@ static int installArchive(FD_t fd, struct fileInfo * files,
|
|||
int mappedFiles = 0;
|
||||
const char * failedFile = NULL;
|
||||
struct callbackInfo info;
|
||||
FD_t cfd;
|
||||
|
||||
if (!files) {
|
||||
/* install all files */
|
||||
|
@ -341,15 +342,11 @@ static int installArchive(FD_t fd, struct fileInfo * files,
|
|||
(void)notify(h, RPMCALLBACK_INST_PROGRESS, 0, archiveSize, pkgKey,
|
||||
notifyData);
|
||||
|
||||
{ CFD_t cfdbuf, *cfd = &cfdbuf;
|
||||
cfd->cpioPos = 0;
|
||||
cfd->cpioIoType = cpioIoTypeGzFd;
|
||||
cfd->cpioGzFd = gzdFdopen(fdDup(fdFileno(fd)), "r");
|
||||
cfd = gzdFdopen(fdDup(fdFileno(fd)), "r");
|
||||
rc = cpioInstallArchive(cfd, map, mappedFiles,
|
||||
((notify && archiveSize) || specFile) ? callback : NULL,
|
||||
&info, &failedFile);
|
||||
gzdClose(cfd->cpioGzFd);
|
||||
}
|
||||
Fclose(cfd);
|
||||
headerFree(info.h);
|
||||
|
||||
if (rc) {
|
||||
|
|
10
lib/macro.c
10
lib/macro.c
|
@ -3,7 +3,9 @@
|
|||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(isblank)
|
||||
#define isblank(_c) ((_c) == ' ' || (_c) == '\t')
|
||||
#endif
|
||||
#define iseol(_c) ((_c) == '\n' || (_c) == '\r')
|
||||
|
||||
#define STREQ(_t, _f, _fn) ((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn)))
|
||||
|
@ -25,8 +27,8 @@
|
|||
typedef int FD_t;
|
||||
#define fdFileno(_x) (_x)
|
||||
#define fdOpen open
|
||||
#define fdRead read
|
||||
#define fdClose close
|
||||
#define Fread(_b, _s, _n, _fd) read(_fd, _b, _s)
|
||||
#define Fclose(_fd) close(_fd)
|
||||
#else
|
||||
#include <rpmlib.h>
|
||||
#endif
|
||||
|
@ -1343,9 +1345,9 @@ int isCompressed(const char *file, int *compressed)
|
|||
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
nb = fdRead(fd, magic, sizeof(magic));
|
||||
nb = Fread(magic, sizeof(magic), 1, fd);
|
||||
rderrno = errno;
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
if (nb < 0) {
|
||||
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, strerror(rderrno));
|
||||
|
|
|
@ -149,7 +149,7 @@ char * oldhdrReadFromFile(char * filename, struct oldrpmHeader * header) {
|
|||
if (fdFileno(fd) < 0) return strerror(errno);
|
||||
|
||||
rc = oldhdrReadFromStream(fd, header);
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ static int readOldHeader(FD_t fd, /*@out@*/Header * hdr, /*@unused@*/ /*@out@*/i
|
|||
int i, j;
|
||||
char ** unames, ** gnames;
|
||||
|
||||
(void)fdLseek(fd, 0, SEEK_SET);
|
||||
(void)Fseek(fd, 0, SEEK_SET);
|
||||
|
||||
if (oldhdrReadFromStream(fd, &oldheader)) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -243,7 +244,8 @@ static int readPackageHeaders(FD_t fd, /*@out@*/struct rpmlead * leadPtr,
|
|||
oldLead->archiveOffset = ntohl(oldLead->archiveOffset);
|
||||
rpmMessage(RPMMESS_DEBUG, _("archive offset is %d\n"),
|
||||
oldLead->archiveOffset);
|
||||
(void)fdLseek(fd, oldLead->archiveOffset, SEEK_SET);
|
||||
|
||||
(void)Fseek(fd, oldLead->archiveOffset, SEEK_SET);
|
||||
|
||||
/* we can't put togeher a header for old format source packages,
|
||||
there just isn't enough information there. We'll return
|
||||
|
|
|
@ -21,7 +21,7 @@ FD_t bzdOpen(const char *pathname, const char *mode) {
|
|||
BZFILE *bzfile;;
|
||||
if ((bzfile = bzopen(pathname, mode)) == NULL)
|
||||
return NULL;
|
||||
fd = fdNew();
|
||||
fd = fdNew(&bzdio);
|
||||
fd->fd_bzd = bzfile;
|
||||
return fd;
|
||||
}
|
||||
|
@ -36,15 +36,6 @@ FD_t bzdFdopen(FD_t fd, const char *mode) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ssize_t bzdRead(FD_t fd, void * buf, size_t count) {
|
||||
*((char *)buf) = '\0';
|
||||
return bzread(bzdFileno(fd), buf, count);
|
||||
}
|
||||
|
||||
ssize_t bzdWrite(FD_t fd, const void * buf, size_t count) {
|
||||
return bzwrite(bzdFileno(fd), (void *)buf, count);
|
||||
}
|
||||
|
||||
int bzdFlush(FD_t fd) {
|
||||
return bzflush(bzdFileno(fd));
|
||||
}
|
||||
|
@ -54,7 +45,24 @@ const char * bzdStrerror(FD_t fd) {
|
|||
return bzerror(bzdFileno(fd), &bzerr);
|
||||
}
|
||||
|
||||
int bzdClose(FD_t fd) {
|
||||
/* =============================================================== */
|
||||
static ssize_t bzdRead(void * cookie, char * buf, size_t count) {
|
||||
FD_t fd = cookie;
|
||||
*((char *)buf) = '\0';
|
||||
return bzread(bzdFileno(fd), buf, count);
|
||||
}
|
||||
|
||||
static ssize_t bzdWrite(void * cookie, const char * buf, size_t count) {
|
||||
FD_t fd = cookie;
|
||||
return bzwrite(bzdFileno(fd), (void *)buf, count);
|
||||
}
|
||||
|
||||
static int bzdSeek(void * cookie, off_t pos, int whence) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int bzdClose(void * cookie) {
|
||||
FD_t fd = cookie;
|
||||
BZFILE *bzfile;
|
||||
|
||||
if (fd != NULL && (bzfile = bzdFileno(fd)) != NULL) {
|
||||
|
@ -67,4 +75,7 @@ int bzdClose(FD_t fd) {
|
|||
}
|
||||
return -2;
|
||||
}
|
||||
|
||||
cookie_io_functions_t bzdio = { bzdRead, bzdWrite, bzdSeek, bzdClose };
|
||||
|
||||
#endif /* HAVE_BZLIB_H */
|
||||
|
|
|
@ -19,7 +19,7 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags, int rc)
|
|||
|
||||
/* close and reset *fdp to NULL */
|
||||
if (*fdp && (fnp == NULL || *fnp == NULL)) {
|
||||
fdClose(*fdp);
|
||||
Fclose(*fdp);
|
||||
*fdp = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -69,15 +69,15 @@ static int copyFile(FD_t *sfdp, const char **sfnp,
|
|||
if (manageFile(tfdp, tfnp, O_WRONLY|O_CREAT|O_TRUNC, 0))
|
||||
goto exit;
|
||||
|
||||
while ((count = fdRead(*sfdp, buffer, sizeof(buffer))) > 0) {
|
||||
if (fdWrite(*tfdp, buffer, count) < 0) {
|
||||
fprintf(stderr, _("%s: fdWrite failed: %s\n"), *tfnp,
|
||||
while ((count = Fread(buffer, sizeof(buffer), 1, *sfdp)) > 0) {
|
||||
if (Fwrite(buffer, count, 1, *tfdp) < 0) {
|
||||
fprintf(stderr, _("%s: Fwrite failed: %s\n"), *tfnp,
|
||||
strerror(errno));
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
if (count < 0) {
|
||||
fprintf(stderr, _("%s: fdRead failed: %s\n"), *sfnp, strerror(errno));
|
||||
fprintf(stderr, _("%s: Fread failed: %s\n"), *sfnp, strerror(errno));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ static Header doGetRecord(rpmdb db, unsigned int offset, int pristine) {
|
|||
int fileCount = 0;
|
||||
int i;
|
||||
|
||||
(void)faLseek(db->pkgs, offset, SEEK_SET);
|
||||
(void)faSeek(db->pkgs, offset, SEEK_SET);
|
||||
|
||||
h = headerRead(faFileno(db->pkgs), HEADER_MAGIC_NO);
|
||||
|
||||
|
@ -659,7 +659,7 @@ int rpmdbAdd(rpmdb db, Header dbentry)
|
|||
if (!dboffset) {
|
||||
rc = 1;
|
||||
} else {
|
||||
(void)faLseek(db->pkgs, dboffset, SEEK_SET);
|
||||
(void)faSeek(db->pkgs, dboffset, SEEK_SET);
|
||||
rc = headerWrite(faFileno(db->pkgs), dbentry, HEADER_MAGIC_NO);
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ int rpmdbUpdateRecord(rpmdb db, int offset, Header newHeader)
|
|||
} else {
|
||||
blockSignals();
|
||||
|
||||
(void)faLseek(db->pkgs, offset, SEEK_SET);
|
||||
(void)faSeek(db->pkgs, offset, SEEK_SET);
|
||||
|
||||
rc = headerWrite(faFileno(db->pkgs), newHeader, HEADER_MAGIC_NO);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static void * showProgress(const Header h, const rpmCallbackType what,
|
|||
return fd;
|
||||
|
||||
case RPMCALLBACK_INST_CLOSE_FILE:
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
break;
|
||||
|
||||
case RPMCALLBACK_INST_START:
|
||||
|
@ -198,7 +198,7 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
|
|||
|
||||
switch (rc) {
|
||||
case 1:
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
rpmMessage(RPMMESS_ERROR,
|
||||
_("%s does not appear to be a RPM package\n"),
|
||||
*filename);
|
||||
|
@ -211,7 +211,7 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
|
|||
case 0:
|
||||
if (isSource) {
|
||||
sourcePackages[numSourcePackages++] = *filename;
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
} else {
|
||||
if (!dbIsOpen) {
|
||||
if (rpmdbOpen(rootdir, &db, mode, 0644)) {
|
||||
|
@ -251,7 +251,7 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
|
|||
relocations);
|
||||
|
||||
headerFree(h); /* XXX reference held by transaction set */
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
switch(rc) {
|
||||
case 0:
|
||||
|
@ -338,7 +338,7 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
|
|||
numFailed += rpmInstallSourcePackage(rootdir, fd, NULL,
|
||||
showProgress, (void *) notifyFlags, NULL);
|
||||
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ int rpmInstallSource(const char * rootdir, const char * arg, const char ** specF
|
|||
if (cookie && *cookie) free(*cookie);
|
||||
}
|
||||
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
42
lib/rpmio.h
42
lib/rpmio.h
|
@ -11,8 +11,22 @@ typedef /*@abstract@*/ struct _FD {
|
|||
/*@owned@*/ void * fd_bzd;
|
||||
/*@owned@*/ void * fd_gzd;
|
||||
void * fd_url;
|
||||
int readOnly; /* falloc.c */
|
||||
unsigned int firstFree; /* falloc.c */
|
||||
long int fileSize; /* falloc.c */
|
||||
long int fd_cpioPos; /* cpio.c */
|
||||
/*@observer@*/ const char *fd_errstr;
|
||||
long int fd_pos;
|
||||
/*@dependent@*/ cookie_io_functions_t *fd_io;
|
||||
} *FD_t;
|
||||
|
||||
/*@observer@*/ const char * Fstrerror(FD_t);
|
||||
|
||||
size_t Fread (/*@out@*/ void *buf, size_t size, size_t nmemb, FD_t fd);
|
||||
size_t Fwrite (const void *buf, size_t size, size_t nmemb, FD_t fd);
|
||||
int Fseek (FD_t fd, long int offset, int whence);
|
||||
int Fclose ( /*@only@*/ FD_t fd);
|
||||
|
||||
#endif /* H_RPMIO */
|
||||
|
||||
#ifndef H_RPMIO_F
|
||||
|
@ -24,20 +38,16 @@ extern "C" {
|
|||
|
||||
int timedRead(FD_t fd, /*@out@*/void * bufptr, int length);
|
||||
|
||||
extern /*@only@*/ /*@null@*/ FD_t fdNew(void);
|
||||
extern /*@only@*/ /*@null@*/ FD_t fdNew(cookie_io_functions_t * iop);
|
||||
extern int fdValid(FD_t fd);
|
||||
extern int fdFileno(FD_t fd);
|
||||
|
||||
extern /*@only@*/ /*@null@*/ FD_t fdOpen(const char *pathname, int flags, mode_t mode);
|
||||
extern /*@only@*/ /*@null@*/ FD_t fdDup(int fdno);
|
||||
|
||||
extern off_t fdLseek(FD_t fd, off_t offset, int whence);
|
||||
extern ssize_t fdRead(FD_t fd, /*@out@*/void * buf, size_t count);
|
||||
extern ssize_t fdWrite(FD_t fd, const void * buf, size_t count);
|
||||
extern int fdClose(/*@only@*/ FD_t fd);
|
||||
|
||||
extern /*@dependent@*/ /*@null@*/ FILE *fdFdopen( /*@only@*/ FD_t fd, const char *mode);
|
||||
|
||||
extern cookie_io_functions_t fdio;
|
||||
|
||||
/*
|
||||
* Support for GZIP library.
|
||||
*/
|
||||
|
@ -51,17 +61,9 @@ extern /*@only@*/ /*@null@*/ FD_t gzdOpen(const char *pathname, const char *mode
|
|||
|
||||
extern /*@only@*/ /*@null@*/ FD_t gzdFdopen( /*@only@*/ FD_t fd, const char *mode);
|
||||
|
||||
extern ssize_t gzdRead(FD_t fd, /*@out@*/ void * buf, size_t count);
|
||||
|
||||
extern ssize_t gzdWrite(FD_t fd, const void * buf, size_t count);
|
||||
|
||||
extern off_t gzdLseek(FD_t fd, off_t offset, int whence);
|
||||
|
||||
extern int gzdFlush(FD_t fd);
|
||||
|
||||
extern /*@only@*/ /*@observer@*/ const char * gzdStrerror(FD_t fd);
|
||||
|
||||
extern int gzdClose( /*@only@*/ FD_t fd);
|
||||
extern cookie_io_functions_t gzdio;
|
||||
|
||||
#endif /* HAVE_ZLIB_H */
|
||||
|
||||
|
@ -78,15 +80,9 @@ extern /*@only@*/ /*@null@*/ FD_t bzdOpen(const char *pathname, const char *mode
|
|||
|
||||
extern /*@only@*/ /*@null@*/ FD_t bzdFdopen( /*@only@*/ FD_t fd, const char *mode);
|
||||
|
||||
extern ssize_t bzdRead(FD_t fd, /*@out@*/ void * buf, size_t count);
|
||||
|
||||
extern ssize_t bzdWrite(FD_t fd, const void * buf, size_t count);
|
||||
|
||||
extern int bzdFlush(FD_t fd);
|
||||
|
||||
extern /*@observer@*/ const char * bzdStrerror(FD_t fd);
|
||||
|
||||
extern int bzdClose( /*@only@*/ FD_t fd);
|
||||
extern cookie_io_functions_t bzdio;
|
||||
|
||||
#endif /* HAVE_BZLIB_H */
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ int writeLead(FD_t fd, struct rpmlead *lead)
|
|||
l.osnum = htons(l.osnum);
|
||||
l.signature_type = htons(l.signature_type);
|
||||
|
||||
if (fdWrite(fd, &l, sizeof(l)) < 0) {
|
||||
if (Fwrite(&l, sizeof(l), 1, fd) < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -278,15 +278,15 @@ void rpmSetVar(int var, const char *val);
|
|||
|
||||
int rpmReadConfigFiles(const char * file, const char * target);
|
||||
int rpmReadRC(const char * file);
|
||||
void rpmGetArchInfo( /*@out@*/ char ** name, /*@out@*/ int * num);
|
||||
void rpmGetOsInfo( /*@out@*/ char ** name, /*@out@*/ int * num);
|
||||
int rpmMachineScore(int type, char * name);
|
||||
void rpmGetArchInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
|
||||
void rpmGetOsInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
|
||||
int rpmMachineScore(int type, const char * name);
|
||||
int rpmShowRC(FILE *f);
|
||||
void rpmSetTables(int archTable, int osTable); /* only used by build code */
|
||||
/* if either are NULL, they are set to the default value (munged uname())
|
||||
pushed through a translation table (if appropriate) */
|
||||
void rpmSetMachine(const char * arch, const char * os);
|
||||
void rpmGetMachine( /*@out@*/ char **arch, /*@out@*/ char **os);
|
||||
void rpmGetMachine( /*@out@*/ const char **arch, /*@out@*/ const char **os);
|
||||
void rpmFreeRpmrc(void);
|
||||
|
||||
/** **/
|
||||
|
|
71
lib/rpmrc.c
71
lib/rpmrc.c
|
@ -104,7 +104,7 @@ static int currTables[2] = { RPM_MACHTABLE_INSTOS, RPM_MACHTABLE_INSTARCH };
|
|||
static struct rpmvarValue values[RPMVAR_NUM];
|
||||
|
||||
/* prototypes */
|
||||
static void defaultMachine(/*@out@*/char ** arch, /*@out@*/char ** os);
|
||||
static void defaultMachine(/*@out@*/ const char ** arch, /*@out@*/ const char ** os);
|
||||
static int doReadRC(FD_t fd, const char * filename);
|
||||
static int optionCompare(const void * a, const void * b);
|
||||
static int addCanon(struct canonEntry **table, int *tableLen, char *line,
|
||||
|
@ -124,24 +124,24 @@ static void setVarDefault(int var, const char *macroname, const char *val, const
|
|||
static void setPathDefault(int var, const char *macroname, const char *subdir);
|
||||
static void setDefaults(void);
|
||||
|
||||
static void rebuildCompatTables(int type, char *name);
|
||||
static void rebuildCompatTables(int type, const char *name);
|
||||
|
||||
/* compatiblity tables */
|
||||
static int machCompatCacheAdd(char * name, const char * fn, int linenum,
|
||||
struct machCache * cache);
|
||||
static struct machCacheEntry * machCacheFindEntry(struct machCache * cache,
|
||||
char * key);
|
||||
const char * key);
|
||||
static struct machEquivInfo * machEquivSearch(
|
||||
struct machEquivTable * table, char * name);
|
||||
static void machAddEquiv(struct machEquivTable * table, char * name,
|
||||
struct machEquivTable * table, const char * name);
|
||||
static void machAddEquiv(struct machEquivTable * table, const char * name,
|
||||
int distance);
|
||||
static void machCacheEntryVisit(struct machCache * cache,
|
||||
struct machEquivTable * table,
|
||||
char * name,
|
||||
const char * name,
|
||||
int distance);
|
||||
static void machFindEquivs(struct machCache * cache,
|
||||
struct machEquivTable * table,
|
||||
char * key);
|
||||
const char * key);
|
||||
|
||||
static int optionCompare(const void * a, const void * b) {
|
||||
return strcasecmp(((struct rpmOption *) a)->name,
|
||||
|
@ -151,7 +151,7 @@ static int optionCompare(const void * a, const void * b) {
|
|||
static void rpmRebuildTargetVars(const char **target, const char ** canontarget);
|
||||
|
||||
static struct machCacheEntry * machCacheFindEntry(struct machCache * cache,
|
||||
char * key)
|
||||
const char * key)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -229,7 +229,7 @@ static int machCompatCacheAdd(char * name, const char * fn, int linenum,
|
|||
}
|
||||
|
||||
static struct machEquivInfo * machEquivSearch(
|
||||
struct machEquivTable * table, char * name)
|
||||
struct machEquivTable * table, const char * name)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -248,7 +248,7 @@ static struct machEquivInfo * machEquivSearch(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void machAddEquiv(struct machEquivTable * table, char * name,
|
||||
static void machAddEquiv(struct machEquivTable * table, const char * name,
|
||||
int distance)
|
||||
{
|
||||
struct machEquivInfo * equiv;
|
||||
|
@ -268,7 +268,7 @@ static void machAddEquiv(struct machEquivTable * table, char * name,
|
|||
|
||||
static void machCacheEntryVisit(struct machCache * cache,
|
||||
struct machEquivTable * table,
|
||||
char * name,
|
||||
const char * name,
|
||||
int distance)
|
||||
{
|
||||
struct machCacheEntry * entry;
|
||||
|
@ -290,7 +290,7 @@ static void machCacheEntryVisit(struct machCache * cache,
|
|||
|
||||
static void machFindEquivs(struct machCache * cache,
|
||||
struct machEquivTable * table,
|
||||
char * key)
|
||||
const char * key)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -579,7 +579,7 @@ int rpmReadRC(const char * rcfiles)
|
|||
break;
|
||||
}
|
||||
rc = doReadRC(fd, fn);
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
if (rc) break;
|
||||
}
|
||||
if (myrcfiles) free(myrcfiles);
|
||||
|
@ -604,7 +604,7 @@ static int doReadRC(FD_t fd, const char * filename)
|
|||
{ struct stat sb;
|
||||
fstat(fdFileno(fd), &sb);
|
||||
next = alloca(sb.st_size + 2);
|
||||
if (fdRead(fd, next, sb.st_size) != sb.st_size) {
|
||||
if (Fread(next, sb.st_size, 1, fd) != sb.st_size) {
|
||||
rpmError(RPMERR_RPMRC, _("Failed to read %s: %s."), filename,
|
||||
strerror(errno));
|
||||
return 1;
|
||||
|
@ -683,7 +683,7 @@ static int doReadRC(FD_t fd, const char * filename)
|
|||
rc = 1;
|
||||
} else {
|
||||
rc = doReadRC(fdinc, fn);
|
||||
fdClose(fdinc);
|
||||
Fclose(fdinc);
|
||||
}
|
||||
if (fn) xfree(fn);
|
||||
if (rc) return rc;
|
||||
|
@ -795,7 +795,7 @@ static int doReadRC(FD_t fd, const char * filename)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void defaultMachine(char ** arch, char ** os) {
|
||||
static void defaultMachine(const char ** arch, const char ** os) {
|
||||
static struct utsname un;
|
||||
static int gotDefaults = 0;
|
||||
char * chptr;
|
||||
|
@ -851,8 +851,8 @@ static void defaultMachine(char ** arch, char ** os) {
|
|||
if (fdFileno(fd) > 0) {
|
||||
chptr = (char *) xcalloc(1, 256);
|
||||
if (chptr != NULL) {
|
||||
int irelid = fdRead(fd, (void *)chptr, 256);
|
||||
fdClose(fd);
|
||||
int irelid = Fread(chptr, 256, 1, fd);
|
||||
Fclose(fd);
|
||||
/* example: "112393 RELEASE 020200 Version 01 OS" */
|
||||
if (irelid > 0) {
|
||||
if ((prelid=strstr(chptr, "RELEASE "))){
|
||||
|
@ -1046,7 +1046,7 @@ static void rpmSetVarArch(int var, const char * val, const char * arch) {
|
|||
}
|
||||
|
||||
void rpmSetTables(int archTable, int osTable) {
|
||||
char * arch, * os;
|
||||
const char * arch, * os;
|
||||
|
||||
defaultMachine(&arch, &os);
|
||||
|
||||
|
@ -1061,12 +1061,12 @@ void rpmSetTables(int archTable, int osTable) {
|
|||
}
|
||||
}
|
||||
|
||||
int rpmMachineScore(int type, char * name) {
|
||||
int rpmMachineScore(int type, const char * name) {
|
||||
struct machEquivInfo * info = machEquivSearch(&tables[type].equiv, name);
|
||||
return (info != NULL ? info->score : 0);
|
||||
}
|
||||
|
||||
void rpmGetMachine(char **arch, char **os)
|
||||
void rpmGetMachine(const char **arch, const char **os)
|
||||
{
|
||||
if (arch)
|
||||
*arch = current[ARCH];
|
||||
|
@ -1076,7 +1076,7 @@ void rpmGetMachine(char **arch, char **os)
|
|||
}
|
||||
|
||||
void rpmSetMachine(const char * arch, const char * os) {
|
||||
char * host_cpu, * host_os;
|
||||
const char * host_cpu, * host_os;
|
||||
|
||||
defaultMachine(&host_cpu, &host_os);
|
||||
|
||||
|
@ -1119,13 +1119,13 @@ void rpmSetMachine(const char * arch, const char * os) {
|
|||
}
|
||||
}
|
||||
|
||||
static void rebuildCompatTables(int type, char * name) {
|
||||
static void rebuildCompatTables(int type, const char * name) {
|
||||
machFindEquivs(&tables[currTables[type]].cache,
|
||||
&tables[currTables[type]].equiv,
|
||||
name);
|
||||
}
|
||||
|
||||
static void getMachineInfo(int type, /*@only@*/ /*@out@*/ char ** name,
|
||||
static void getMachineInfo(int type, /*@only@*/ /*@out@*/ const char ** name,
|
||||
/*@out@*/int * num)
|
||||
{
|
||||
struct canonEntry * canon;
|
||||
|
@ -1152,11 +1152,11 @@ static void getMachineInfo(int type, /*@only@*/ /*@out@*/ char ** name,
|
|||
}
|
||||
}
|
||||
|
||||
void rpmGetArchInfo(char ** name, int * num) {
|
||||
void rpmGetArchInfo(const char ** name, int * num) {
|
||||
getMachineInfo(ARCH, name, num);
|
||||
}
|
||||
|
||||
void rpmGetOsInfo(char ** name, int * num) {
|
||||
void rpmGetOsInfo(const char ** name, int * num) {
|
||||
getMachineInfo(OS, name, num);
|
||||
}
|
||||
|
||||
|
@ -1192,24 +1192,27 @@ void rpmRebuildTargetVars(const char **buildtarget, const char ** canontarget)
|
|||
if (co != NULL) co = xstrdup(co);
|
||||
}
|
||||
} else {
|
||||
const char *a, *o;
|
||||
/* Set build target from rpm arch and os */
|
||||
rpmGetArchInfo(&ca,NULL);
|
||||
if (ca) ca = xstrdup(ca);
|
||||
rpmGetOsInfo(&co,NULL);
|
||||
if (co) co = xstrdup(co);
|
||||
rpmGetArchInfo(&a,NULL);
|
||||
ca = (a) ? xstrdup(a) : NULL;
|
||||
rpmGetOsInfo(&o,NULL);
|
||||
co = (o) ? xstrdup(o) : NULL;
|
||||
}
|
||||
|
||||
/* If still not set, Set target arch/os from default uname(2) values */
|
||||
if (ca == NULL) {
|
||||
defaultMachine(&ca, NULL);
|
||||
ca = xstrdup(ca);
|
||||
const char *a;
|
||||
defaultMachine(&a, NULL);
|
||||
ca = (a) ? xstrdup(a) : NULL;
|
||||
}
|
||||
for (x = 0; ca[x]; x++)
|
||||
ca[x] = tolower(ca[x]);
|
||||
|
||||
if (co == NULL) {
|
||||
defaultMachine(NULL, &co);
|
||||
co = xstrdup(co);
|
||||
const char *o;
|
||||
defaultMachine(NULL, &o);
|
||||
co = (o) ? xstrdup(co) : NULL;
|
||||
}
|
||||
for (x = 0; co[x]; x++)
|
||||
co[x] = tolower(co[x]);
|
||||
|
|
|
@ -202,7 +202,7 @@ int rpmWriteSignature(FD_t fd, Header header)
|
|||
rpmMessage(RPMMESS_DEBUG, _("Signature size: %d\n"), sigSize);
|
||||
rpmMessage(RPMMESS_DEBUG, _("Signature pad : %d\n"), pad);
|
||||
memset(buf, 0, pad);
|
||||
if (fdWrite(fd, buf, pad) != pad)
|
||||
if (Fwrite(buf, pad, 1, fd) != pad)
|
||||
rc = 1;
|
||||
}
|
||||
return rc;
|
||||
|
@ -294,7 +294,7 @@ static int makePGPSignature(const char *file, /*@out@*/void **sig, /*@out@*/int_
|
|||
fd = fdOpen(sigfile, O_RDONLY, 0);
|
||||
rc = timedRead(fd, *sig, *size);
|
||||
unlink(sigfile);
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
if (rc != *size) {
|
||||
free(*sig);
|
||||
rpmError(RPMERR_SIGGEN, _("unable to read the signature"));
|
||||
|
@ -371,7 +371,7 @@ static int makeGPGSignature(const char *file, /*@out@*/void **sig, /*@out@*/int_
|
|||
fd = fdOpen(sigfile, O_RDONLY, 0);
|
||||
rc = timedRead(fd, *sig, *size);
|
||||
unlink(sigfile);
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
if (rc != *size) {
|
||||
free(*sig);
|
||||
rpmError(RPMERR_SIGGEN, _("unable to read the signature"));
|
||||
|
@ -506,8 +506,8 @@ static int verifyPGPSignature(const char *datafile, void *sig,
|
|||
xfree(tmppath);
|
||||
}
|
||||
sfd = fdOpen(sigfile, O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
||||
(void)fdWrite(sfd, sig, count);
|
||||
fdClose(sfd);
|
||||
(void)Fwrite(sig, count, 1, sfd);
|
||||
Fclose(sfd);
|
||||
|
||||
/* Now run PGP */
|
||||
outpipe[0] = outpipe[1] = 0;
|
||||
|
@ -601,8 +601,8 @@ static int verifyGPGSignature(const char *datafile, void *sig,
|
|||
xfree(tmppath);
|
||||
}
|
||||
sfd = fdOpen(sigfile, O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
||||
(void)fdWrite(sfd, sig, count);
|
||||
fdClose(sfd);
|
||||
(void)Fwrite(sig, count, 1, sfd);
|
||||
Fclose(sfd);
|
||||
|
||||
/* Now run GPG */
|
||||
outpipe[0] = outpipe[1] = 0;
|
||||
|
|
|
@ -12,7 +12,7 @@ int timedRead(FD_t fd, void * bufptr, int length) {
|
|||
|
||||
fstat(fdFileno(fd), &sb);
|
||||
if (S_ISREG(sb.st_mode))
|
||||
return fdRead(fd, buf, length);
|
||||
return Fread(buf, length, 1, fd);
|
||||
|
||||
while (total < length) {
|
||||
FD_ZERO(&readSet);
|
||||
|
@ -24,7 +24,7 @@ int timedRead(FD_t fd, void * bufptr, int length) {
|
|||
if (select(fdFileno(fd) + 1, &readSet, NULL, NULL, &tv) != 1)
|
||||
return total;
|
||||
|
||||
bytesRead = fdRead(fd, buf + total, length - total);
|
||||
bytesRead = Fread(buf + total, length - total, 1, fd);
|
||||
|
||||
if (bytesRead < 0)
|
||||
return bytesRead;
|
||||
|
|
|
@ -288,10 +288,10 @@ static int runScript(Header h, const char * root, int progArgc, const char ** pr
|
|||
|
||||
if (rpmIsDebug() &&
|
||||
(!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash")))
|
||||
(void)fdWrite(fd, "set -x\n", 7);
|
||||
(void)Fwrite("set -x\n", 7, 1, fd);
|
||||
|
||||
(void)fdWrite(fd, script, strlen(script));
|
||||
fdClose(fd);
|
||||
(void)Fwrite(script, strlen(script), 1, fd);
|
||||
Fclose(fd);
|
||||
|
||||
argv[argc++] = fn + strlen(root);
|
||||
if (arg1 >= 0) {
|
||||
|
@ -337,9 +337,9 @@ static int runScript(Header h, const char * root, int progArgc, const char ** pr
|
|||
dup2(fdFileno(out), STDOUT_FILENO);
|
||||
/* make sure we don't close stdin/stderr/stdout by mistake! */
|
||||
if (fdFileno(out) > STDERR_FILENO && fdFileno(out) != fdFileno(errfd))
|
||||
fdClose (out);
|
||||
Fclose (out);
|
||||
if (fdFileno(errfd) > STDERR_FILENO)
|
||||
fdClose (errfd);
|
||||
Fclose (errfd);
|
||||
}
|
||||
|
||||
doputenv(SCRIPT_PATH);
|
||||
|
@ -370,7 +370,7 @@ static int runScript(Header h, const char * root, int progArgc, const char ** pr
|
|||
|
||||
if (freePrefixes) free(prefixes);
|
||||
|
||||
fdClose(out); /* XXX dup'd STDOUT_FILENO */
|
||||
Fclose(out); /* XXX dup'd STDOUT_FILENO */
|
||||
|
||||
if (script) {
|
||||
if (!rpmIsDebug()) unlink(fn);
|
||||
|
|
10
lib/url.c
10
lib/url.c
|
@ -370,7 +370,7 @@ int ufdClose(FD_t fd)
|
|||
u->ftpControl = -1;
|
||||
}
|
||||
}
|
||||
return fdClose(fd);
|
||||
return Fclose(fd);
|
||||
}
|
||||
|
||||
FD_t ufdOpen(const char *url, int flags, mode_t mode)
|
||||
|
@ -382,7 +382,7 @@ FD_t ufdOpen(const char *url, int flags, mode_t mode)
|
|||
case URL_IS_FTP:
|
||||
if (urlConnect(url, &u) < 0)
|
||||
break;
|
||||
if ((fd = fdNew()) == NULL)
|
||||
if ((fd = fdNew(&fdio)) == NULL)
|
||||
break;
|
||||
fd->fd_url = u;
|
||||
if ((u->openError = ftpGetFileDesc(fd)) < 0) {
|
||||
|
@ -393,7 +393,7 @@ FD_t ufdOpen(const char *url, int flags, mode_t mode)
|
|||
case URL_IS_HTTP:
|
||||
if (urlSplit(url, &u))
|
||||
break;
|
||||
if ((fd = fdNew()) == NULL)
|
||||
if ((fd = fdNew(&fdio)) == NULL)
|
||||
break;
|
||||
fd->fd_url = u;
|
||||
fd->fd_fd = httpOpen(u);
|
||||
|
@ -444,7 +444,7 @@ int urlGetFile(const char * url, const char * dest) {
|
|||
tfd = fdOpen(dest, O_CREAT|O_WRONLY|O_TRUNC, 0600);
|
||||
if (fdFileno(tfd) < 0) {
|
||||
rpmMessage(RPMMESS_DEBUG, _("failed to create %s\n"), dest);
|
||||
fdClose(tfd);
|
||||
Fclose(tfd);
|
||||
ufdClose(sfd);
|
||||
return FTPERR_UNKNOWN;
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ int urlGetFile(const char * url, const char * dest) {
|
|||
break;
|
||||
}
|
||||
|
||||
fdClose(tfd);
|
||||
Fclose(tfd);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ int showVerifyPackage(QVA_t *qva, rpmdb db, Header h)
|
|||
if ((qva->qva_flags & VERIFY_SCRIPT) &&
|
||||
(rc = rpmVerifyScript(qva->qva_prefix, h, fdo)) != 0)
|
||||
ec = rc;
|
||||
fdClose(fdo);
|
||||
Fclose(fdo);
|
||||
return ec;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ lib/package.c
|
|||
lib/problems.c
|
||||
lib/query.c
|
||||
lib/rebuilddb.c
|
||||
lib/rpmbzio.c
|
||||
lib/rpmchecksig.c
|
||||
lib/rpmdb.c
|
||||
lib/rpmerr.c
|
||||
|
|
565
po/pt_BR.po
565
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
162
po/rpm.pot
162
po/rpm.pot
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 1999-10-21 16:34-0400\n"
|
||||
"POT-Creation-Date: 1999-10-27 18:55-0400\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"
|
||||
|
@ -1224,7 +1224,7 @@ msgstr ""
|
|||
msgid "error reading header from package\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/build.c:83 build/pack.c:266
|
||||
#: build/build.c:83 build/pack.c:267
|
||||
msgid "Unable to open temp file"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1484,46 +1484,46 @@ msgstr ""
|
|||
msgid "readRPM: read %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:214
|
||||
#: build/pack.c:215
|
||||
#, c-format
|
||||
msgid "readRPM: %s is not an RPM package\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:220
|
||||
#: build/pack.c:221
|
||||
#, c-format
|
||||
msgid "readRPM: reading header from %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:277
|
||||
#: build/pack.c:278
|
||||
msgid "Bad CSA data"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:308
|
||||
#: build/pack.c:311
|
||||
#, c-format
|
||||
msgid "Could not open %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:340 build/pack.c:382
|
||||
#: build/pack.c:343 build/pack.c:385
|
||||
#, c-format
|
||||
msgid "Unable to write package: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:355
|
||||
#: build/pack.c:358
|
||||
#, c-format
|
||||
msgid "Generating signature: %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:372
|
||||
#: build/pack.c:375
|
||||
#, c-format
|
||||
msgid "Unable to read sigtarget: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:397
|
||||
#: build/pack.c:400
|
||||
#, c-format
|
||||
msgid "Wrote: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:414 build/pack.c:438
|
||||
#: build/pack.c:416 build/pack.c:439
|
||||
#, c-format
|
||||
msgid "create archive failed on file %s: %s"
|
||||
msgstr ""
|
||||
|
@ -1606,17 +1606,17 @@ msgstr ""
|
|||
msgid "line %d: Bad option %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseDescription.c:60 build/parseFiles.c:54 build/parseScript.c:182
|
||||
#: build/parseDescription.c:59 build/parseFiles.c:53 build/parseScript.c:181
|
||||
#, c-format
|
||||
msgid "line %d: Too many names: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseDescription.c:70 build/parseFiles.c:64 build/parseScript.c:192
|
||||
#: build/parseDescription.c:69 build/parseFiles.c:63 build/parseScript.c:191
|
||||
#, c-format
|
||||
msgid "line %d: Package does not exist: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseDescription.c:82
|
||||
#: build/parseDescription.c:81
|
||||
#, c-format
|
||||
msgid "line %d: Second description"
|
||||
msgstr ""
|
||||
|
@ -1625,7 +1625,7 @@ msgstr ""
|
|||
msgid "line %d: Error parsing %%files: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseFiles.c:72
|
||||
#: build/parseFiles.c:71
|
||||
msgid "line %d: Second %%files list"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1830,7 +1830,7 @@ msgstr ""
|
|||
msgid "line %d: triggers must have --: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseScript.c:146 build/parseScript.c:210
|
||||
#: build/parseScript.c:146 build/parseScript.c:209
|
||||
#, c-format
|
||||
msgid "line %d: Error parsing %s: %s"
|
||||
msgstr ""
|
||||
|
@ -1840,7 +1840,7 @@ msgstr ""
|
|||
msgid "line %d: script program must begin with '/': %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseScript.c:201
|
||||
#: build/parseScript.c:200
|
||||
#, c-format
|
||||
msgid "line %d: Second %s"
|
||||
msgstr ""
|
||||
|
@ -1850,44 +1850,44 @@ msgstr ""
|
|||
msgid "line %d: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseSpec.c:172
|
||||
#: build/parseSpec.c:173
|
||||
#, c-format
|
||||
msgid "Unable to open: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseSpec.c:184
|
||||
#: build/parseSpec.c:185
|
||||
msgid "Unclosed %%if"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseSpec.c:243
|
||||
#: build/parseSpec.c:244
|
||||
#, c-format
|
||||
msgid "%s:%d: parseExpressionBoolean returns %d"
|
||||
msgstr ""
|
||||
|
||||
#. Got an else with no %if !
|
||||
#: build/parseSpec.c:251
|
||||
#: build/parseSpec.c:252
|
||||
msgid "%s:%d: Got a %%else with no if"
|
||||
msgstr ""
|
||||
|
||||
#. Got an end with no %if !
|
||||
#: build/parseSpec.c:262
|
||||
#: build/parseSpec.c:263
|
||||
msgid "%s:%d: Got a %%endif with no if"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseSpec.c:276 build/parseSpec.c:285
|
||||
#: build/parseSpec.c:277 build/parseSpec.c:286
|
||||
msgid "malformed %%include statement"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseSpec.c:366
|
||||
#: build/parseSpec.c:367
|
||||
#, c-format
|
||||
msgid "Timecheck value must be an integer: %s"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseSpec.c:449
|
||||
#: build/parseSpec.c:450
|
||||
msgid "No buildable architectures"
|
||||
msgstr ""
|
||||
|
||||
#: build/parseSpec.c:494
|
||||
#: build/parseSpec.c:497
|
||||
msgid "Package has no %%description: %s"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1911,51 +1911,51 @@ msgstr ""
|
|||
msgid "line %d: Bad %s number: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:385
|
||||
#: lib/cpio.c:335
|
||||
#, c-format
|
||||
msgid "can't rename %s to %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:391
|
||||
#: lib/cpio.c:341
|
||||
#, c-format
|
||||
msgid "can't unlink %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:582
|
||||
#: lib/cpio.c:532
|
||||
#, c-format
|
||||
msgid "getNextHeader: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1044
|
||||
#: lib/cpio.c:995
|
||||
#, c-format
|
||||
msgid "(error 0x%x)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1047
|
||||
#: lib/cpio.c:998
|
||||
msgid "Bad magic"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1048
|
||||
#: lib/cpio.c:999
|
||||
msgid "Bad/unreadable header"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1066
|
||||
#: lib/cpio.c:1017
|
||||
msgid "Header size too big"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1067
|
||||
#: lib/cpio.c:1018
|
||||
msgid "Unknown file type"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1068
|
||||
#: lib/cpio.c:1019
|
||||
msgid "Missing hard link"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1069
|
||||
#: lib/cpio.c:1020
|
||||
msgid "Internal error"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1078
|
||||
#: lib/cpio.c:1029
|
||||
msgid " failed - "
|
||||
msgstr ""
|
||||
|
||||
|
@ -2063,7 +2063,7 @@ msgstr ""
|
|||
msgid "loop in prerequisite chain: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/falloc.c:174
|
||||
#: lib/falloc.c:157
|
||||
#, c-format
|
||||
msgid ""
|
||||
"free list corrupt (%u)- please run\n"
|
||||
|
@ -2256,86 +2256,86 @@ 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:358
|
||||
#: lib/install.c:355
|
||||
#, c-format
|
||||
msgid "unpacking of archive failed%s%s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:359
|
||||
#: lib/install.c:356
|
||||
msgid " on file "
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:402
|
||||
#: lib/install.c:399
|
||||
msgid "installing a source package\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:413
|
||||
#: lib/install.c:410
|
||||
#, c-format
|
||||
msgid "cannot create %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:421 lib/install.c:443
|
||||
#: lib/install.c:418 lib/install.c:440
|
||||
#, c-format
|
||||
msgid "cannot write to %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:425
|
||||
#: lib/install.c:422
|
||||
#, c-format
|
||||
msgid "sources in: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:436
|
||||
#: lib/install.c:433
|
||||
#, c-format
|
||||
msgid "cannot create %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:447
|
||||
#: lib/install.c:444
|
||||
#, c-format
|
||||
msgid "spec file in: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:481 lib/install.c:509
|
||||
#: lib/install.c:478 lib/install.c:506
|
||||
msgid "source package contains no .spec file"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:530
|
||||
#: lib/install.c:527
|
||||
#, c-format
|
||||
msgid "renaming %s to %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:532 lib/install.c:810 lib/uninstall.c:26
|
||||
#: lib/install.c:529 lib/install.c:807 lib/uninstall.c:26
|
||||
#, c-format
|
||||
msgid "rename of %s to %s failed: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:622
|
||||
#: lib/install.c:619
|
||||
msgid "source package expected, binary found"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:679
|
||||
#: lib/install.c:676
|
||||
#, c-format
|
||||
msgid "package: %s-%s-%s files test = %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:740
|
||||
#: lib/install.c:737
|
||||
msgid "stopping install as we're running --test\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:745
|
||||
#: lib/install.c:742
|
||||
msgid "running preinstall script (if any)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:770
|
||||
#: lib/install.c:767
|
||||
#, c-format
|
||||
msgid "warning: %s created as %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:806
|
||||
#: lib/install.c:803
|
||||
#, c-format
|
||||
msgid "warning: %s saved as %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:880
|
||||
#: lib/install.c:877
|
||||
msgid "running postinstall scripts (if any)\n"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2344,83 +2344,83 @@ msgstr ""
|
|||
msgid "cannot read header at %d for lookup"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:149
|
||||
#: lib/macro.c:151
|
||||
#, c-format
|
||||
msgid "======================== active %d empty %d\n"
|
||||
msgstr ""
|
||||
|
||||
#. XXX just in case
|
||||
#: lib/macro.c:243
|
||||
#: lib/macro.c:245
|
||||
#, c-format
|
||||
msgid "%3d>%*s(empty)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:278
|
||||
#: lib/macro.c:280
|
||||
#, c-format
|
||||
msgid "%3d<%*s(empty)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:457
|
||||
#: lib/macro.c:459
|
||||
msgid "Macro %%%s has unterminated body"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:483
|
||||
#: lib/macro.c:485
|
||||
msgid "Macro %%%s has illegal name (%%define)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:489
|
||||
#: lib/macro.c:491
|
||||
msgid "Macro %%%s has unterminated opts"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:494
|
||||
#: lib/macro.c:496
|
||||
msgid "Macro %%%s has empty body"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:499
|
||||
#: lib/macro.c:501
|
||||
msgid "Macro %%%s failed to expand"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:524
|
||||
#: lib/macro.c:526
|
||||
msgid "Macro %%%s has illegal name (%%undefine)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:601
|
||||
#: lib/macro.c:603
|
||||
msgid "Macro %%%s (%s) was not used below level %d"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:698
|
||||
#: lib/macro.c:700
|
||||
#, c-format
|
||||
msgid "Unknown option %c in %s(%s)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:870
|
||||
#: lib/macro.c:872
|
||||
#, c-format
|
||||
msgid "Recursion depth(%d) greater than max(%d)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:936 lib/macro.c:952
|
||||
#: lib/macro.c:938 lib/macro.c:954
|
||||
#, c-format
|
||||
msgid "Unterminated %c: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:992
|
||||
#: lib/macro.c:994
|
||||
msgid "A %% is followed by an unparseable macro"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:1115
|
||||
#: lib/macro.c:1117
|
||||
msgid "Macro %%%.*s not found, skipping"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:1196
|
||||
#: lib/macro.c:1198
|
||||
msgid "Target buffer overflow"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:1343 lib/macro.c:1351
|
||||
#: lib/macro.c:1345 lib/macro.c:1353
|
||||
#, c-format
|
||||
msgid "File %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/macro.c:1354
|
||||
#: lib/macro.c:1356
|
||||
#, c-format
|
||||
msgid "File %s is smaller than %d bytes"
|
||||
msgstr ""
|
||||
|
@ -2451,24 +2451,24 @@ msgstr ""
|
|||
msgid "bad file state: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/package.c:236
|
||||
#: lib/package.c:237
|
||||
msgid "package is a version one package!\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/package.c:241
|
||||
#: lib/package.c:242
|
||||
msgid "old style source package -- I'll do my best\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/package.c:244
|
||||
#: lib/package.c:245
|
||||
#, c-format
|
||||
msgid "archive offset is %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/package.c:254
|
||||
#: lib/package.c:256
|
||||
msgid "old style binary package\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/package.c:314
|
||||
#: lib/package.c:316
|
||||
msgid ""
|
||||
"only packages with major numbers <= 3 are supported by this version of RPM"
|
||||
msgstr ""
|
||||
|
@ -2794,12 +2794,12 @@ msgstr ""
|
|||
|
||||
#: lib/rpmchecksig.c:74
|
||||
#, c-format
|
||||
msgid "%s: fdWrite failed: %s\n"
|
||||
msgid "%s: Fwrite failed: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmchecksig.c:80
|
||||
#, c-format
|
||||
msgid "%s: fdRead failed: %s\n"
|
||||
msgid "%s: Fread failed: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmchecksig.c:113 lib/rpmchecksig.c:242
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 1999-10-25 16:06-0400\n"
|
||||
"POT-Creation-Date: 1999-10-26 13:07-0400\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"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: POPT\n"
|
||||
"POT-Creation-Date: 1999-10-22 17:29-0400\n"
|
||||
"POT-Creation-Date: 1999-10-26 13:07-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Cristian Gafton <gafton@redhat.com>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: popt\n"
|
||||
"POT-Creation-Date: 1999-10-22 17:29-0400\n"
|
||||
"POT-Creation-Date: 1999-10-26 13:07-0400\n"
|
||||
"PO-Revision-Date: 1999-08-04 21:40+0200\n"
|
||||
"Last-Translator: Stanislav Meduna <stano@eunet.sk>\n"
|
||||
"Language-Team: Slovak <sk-i18n@rak.isternet.sk>\n"
|
||||
|
|
12
popt/popt.3
12
popt/popt.3
|
@ -6,7 +6,7 @@ popt \- Parse command line options
|
|||
.B #include <popt.h>
|
||||
.sp
|
||||
.BI "poptContext poptGetContext(const char * " name ", int " argc ,
|
||||
.BI " har ** "argv ,
|
||||
.BI " const char ** "argv ,
|
||||
.BI " const struct poptOption * " options ,
|
||||
.BI " int " flags );
|
||||
.sp
|
||||
|
@ -16,9 +16,9 @@ popt \- Parse command line options
|
|||
.sp
|
||||
.BI "int poptGetNextOpt(poptContext " con );
|
||||
.sp
|
||||
.BI "char * poptGetOptArg(poptContext " con );
|
||||
.BI "const char * poptGetOptArg(poptContext " con );
|
||||
.sp
|
||||
.BI "char * poptGetArg(poptContext " con );
|
||||
.BI "const char * poptGetArg(poptContext " con );
|
||||
.sp
|
||||
.BI "const char * poptPeekArg(poptContext " con );
|
||||
.sp
|
||||
|
@ -246,7 +246,7 @@ modified outside the popt library.
|
|||
.sp
|
||||
.nf
|
||||
.BI "poptContext poptGetContext(const char * " name ", int "argc ",
|
||||
.BI " char ** "argv ",
|
||||
.BI " const char ** "argv ",
|
||||
.BI " const struct poptOption * "options ",
|
||||
.BI " int "flags ");"
|
||||
.fi
|
||||
|
@ -333,7 +333,7 @@ ways to discover them. One is to ask popt to fill in a variable with the
|
|||
.sp
|
||||
.nf
|
||||
.B #include <popt.h>
|
||||
.BI "char * poptGetOptArg(poptContext " con ");"
|
||||
.BI "const char * poptGetOptArg(poptContext " con ");"
|
||||
.fi
|
||||
.sp
|
||||
This function returns the argument given for the final option returned by
|
||||
|
@ -347,7 +347,7 @@ of leftover arguments. Three functions allow applications to access such
|
|||
arguments:
|
||||
.nf
|
||||
.HP
|
||||
.BI "char * poptGetArg(poptContext " con ");"
|
||||
.BI "const char * poptGetArg(poptContext " con ");"
|
||||
.fi
|
||||
This function returns the next leftover argument and marks it as
|
||||
processed.
|
||||
|
|
12
popt/popt.c
12
popt/popt.c
|
@ -43,7 +43,7 @@ static void invokeCallbacks(poptContext con, const struct poptOption * table,
|
|||
}
|
||||
}
|
||||
|
||||
poptContext poptGetContext(const char * name, int argc, char ** argv,
|
||||
poptContext poptGetContext(const char * name, int argc, const char ** argv,
|
||||
const struct poptOption * options, int flags) {
|
||||
poptContext con = malloc(sizeof(*con));
|
||||
|
||||
|
@ -51,7 +51,7 @@ poptContext poptGetContext(const char * name, int argc, char ** argv,
|
|||
|
||||
con->os = con->optionStack;
|
||||
con->os->argc = argc;
|
||||
con->os->argv = (const char **) argv; /* XXX don't change the API */
|
||||
con->os->argv = argv;
|
||||
con->os->argb = NULL;
|
||||
|
||||
if (!(flags & POPT_CONTEXT_KEEP_FIRST))
|
||||
|
@ -569,15 +569,15 @@ int poptGetNextOpt(poptContext con)
|
|||
return opt->val;
|
||||
}
|
||||
|
||||
char * poptGetOptArg(poptContext con) {
|
||||
char * ret = (char *)con->os->nextArg; /* XXX don't change the API */
|
||||
const char * poptGetOptArg(poptContext con) {
|
||||
const char * ret = con->os->nextArg;
|
||||
con->os->nextArg = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
char * poptGetArg(poptContext con) {
|
||||
const char * poptGetArg(poptContext con) {
|
||||
if (con->numLeftovers == con->nextLeftover) return NULL;
|
||||
return (char *)con->leftovers[con->nextLeftover++]; /* XXX don't change the API */
|
||||
return con->leftovers[con->nextLeftover++];
|
||||
}
|
||||
|
||||
const char * poptPeekArg(poptContext con) {
|
||||
|
|
|
@ -86,16 +86,16 @@ typedef void (*poptCallbackType)(poptContext con,
|
|||
const char * arg, const void * data);
|
||||
|
||||
/*@only@*/ poptContext poptGetContext(/*@keep@*/ const char * name,
|
||||
int argc, /*@keep@*/ char ** argv,
|
||||
int argc, /*@keep@*/ const char ** argv,
|
||||
/*@keep@*/ const struct poptOption * options, int flags);
|
||||
void poptResetContext(poptContext con);
|
||||
|
||||
/* returns 'val' element, -1 on last item, POPT_ERROR_* on error */
|
||||
int poptGetNextOpt(poptContext con);
|
||||
/* returns NULL if no argument is available */
|
||||
/*@observer@*/ /*@null@*/ char * poptGetOptArg(poptContext con);
|
||||
/*@observer@*/ /*@null@*/ const char * poptGetOptArg(poptContext con);
|
||||
/* returns NULL if no more options are available */
|
||||
/*@observer@*/ /*@null@*/ char * poptGetArg(poptContext con);
|
||||
/*@observer@*/ /*@null@*/ const char * poptGetArg(poptContext con);
|
||||
/*@observer@*/ /*@null@*/ const char * poptPeekArg(poptContext con);
|
||||
/*@observer@*/ /*@null@*/ const char ** poptGetArgs(poptContext con);
|
||||
/* returns the option which caused the most recent error */
|
||||
|
|
|
@ -66,7 +66,7 @@ static void resetVars(void)
|
|||
pass2 = 0;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
int main(int argc, const char ** argv) {
|
||||
int rc;
|
||||
int ec = 0;
|
||||
poptContext optCon;
|
||||
|
|
|
@ -46,7 +46,7 @@ char *fax = NULL;
|
|||
|
||||
|
||||
int
|
||||
main(int argc, char**argv ) {
|
||||
main(int argc, const char ** argv) {
|
||||
|
||||
poptContext optCon; /* context for parsing command-line options */
|
||||
struct poptOption userOptionsTable[] = {
|
||||
|
|
|
@ -60,7 +60,7 @@ static PyObject * rpmtransRun(rpmtransObject * s, PyObject * args);
|
|||
static PyObject * rpmtransOrder(rpmtransObject * s, PyObject * args);
|
||||
static void rpmtransDealloc(PyObject * o);
|
||||
static PyObject * rpmtransGetAttr(rpmtransObject * o, char * name);
|
||||
static int rpmtransSetAttr(rpmtransObject * o, char * name,
|
||||
static int rpmtransSetAttr(rpmtransObject * o, char * name,
|
||||
PyObject * val);
|
||||
|
||||
/* Types */
|
||||
|
@ -74,7 +74,7 @@ static PyMethodDef rpmModuleMethods[] = {
|
|||
{ "headerLoad", (PyCFunction) hdrLoad, METH_VARARGS, NULL },
|
||||
{ "opendb", (PyCFunction) rpmOpenDB, METH_VARARGS, NULL },
|
||||
{ "rebuilddb", (PyCFunction) rebuildDB, METH_VARARGS, NULL },
|
||||
{ "readHeaderListFromFD", (PyCFunction) rpmHeaderFromFD, METH_VARARGS, NULL },
|
||||
{ "readHeaderListFromFD", (PyCFunction) rpmHeaderFromFD, METH_VARARGS, NULL },
|
||||
{ "readHeaderListFromFile", (PyCFunction) rpmHeaderFromFile, METH_VARARGS, NULL },
|
||||
{ "errorSetCallback", (PyCFunction) errorSetCallback, METH_VARARGS, NULL },
|
||||
{ "errorString", (PyCFunction) errorString, METH_VARARGS, NULL },
|
||||
|
@ -202,7 +202,7 @@ static struct PyMethodDef hdrMethods[] = {
|
|||
|
||||
/* External functions */
|
||||
int mdfile(const char *fn, unsigned char *digest);
|
||||
|
||||
|
||||
/* Code */
|
||||
|
||||
void initrpm(void) {
|
||||
|
@ -228,22 +228,22 @@ void initrpm(void) {
|
|||
|
||||
PyDict_SetItemString(d, "tagnames", dict);
|
||||
|
||||
PyDict_SetItemString(d, "RPMFILE_STATE_NORMAL",
|
||||
PyDict_SetItemString(d, "RPMFILE_STATE_NORMAL",
|
||||
PyInt_FromLong(RPMFILE_STATE_NORMAL));
|
||||
PyDict_SetItemString(d, "RPMFILE_STATE_REPLACED",
|
||||
PyDict_SetItemString(d, "RPMFILE_STATE_REPLACED",
|
||||
PyInt_FromLong(RPMFILE_STATE_REPLACED));
|
||||
PyDict_SetItemString(d, "RPMFILE_STATE_NOTINSTALLED",
|
||||
PyDict_SetItemString(d, "RPMFILE_STATE_NOTINSTALLED",
|
||||
PyInt_FromLong(RPMFILE_STATE_NOTINSTALLED));
|
||||
PyDict_SetItemString(d, "RPMFILE_CONFIG",
|
||||
PyDict_SetItemString(d, "RPMFILE_CONFIG",
|
||||
PyInt_FromLong(RPMFILE_CONFIG));
|
||||
PyDict_SetItemString(d, "RPMFILE_MISSINGOK",
|
||||
PyInt_FromLong(RPMFILE_MISSINGOK));
|
||||
PyDict_SetItemString(d, "RPMFILE_DOC",
|
||||
PyDict_SetItemString(d, "RPMFILE_DOC",
|
||||
PyInt_FromLong(RPMFILE_DOC));
|
||||
|
||||
PyDict_SetItemString(d, "RPMDEP_SENSE_REQUIRES",
|
||||
PyDict_SetItemString(d, "RPMDEP_SENSE_REQUIRES",
|
||||
PyInt_FromLong(RPMDEP_SENSE_REQUIRES));
|
||||
PyDict_SetItemString(d, "RPMDEP_SENSE_CONFLICTS",
|
||||
PyDict_SetItemString(d, "RPMDEP_SENSE_CONFLICTS",
|
||||
PyInt_FromLong(RPMDEP_SENSE_CONFLICTS));
|
||||
|
||||
PyDict_SetItemString(d, "RPMSENSE_SERIAL",
|
||||
|
@ -421,12 +421,12 @@ static PyObject * findUpgradeSet(PyObject * self, PyObject * args) {
|
|||
list.packages[i]->selected = 0;
|
||||
list.packages[i]->data = hdr;
|
||||
|
||||
headerGetEntry(hdr->h, RPMTAG_NAME, NULL,
|
||||
headerGetEntry(hdr->h, RPMTAG_NAME, NULL,
|
||||
(void **) &list.packages[i]->name, NULL);
|
||||
}
|
||||
|
||||
pkgSort (&list);
|
||||
|
||||
|
||||
if (ugFindUpgradePackages(&list, root)) {
|
||||
PyErr_SetString(pyrpmError, "error during upgrade check");
|
||||
return NULL;
|
||||
|
@ -457,7 +457,7 @@ static rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) {
|
|||
char * errmsg = "cannot open database in %s";
|
||||
char * errstr = NULL;
|
||||
int errsize;
|
||||
|
||||
|
||||
Py_DECREF(o);
|
||||
/* PyErr_SetString should take varargs... */
|
||||
errsize = strlen(errmsg) + *root == '\0' ? 15 /* "/var/lib/rpm" */ : strlen(root);
|
||||
|
@ -518,12 +518,12 @@ static PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args) {
|
|||
FD_t fd;
|
||||
int fileno;
|
||||
PyObject * list;
|
||||
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &fileno)) return NULL;
|
||||
fd = fdDup(fileno);
|
||||
|
||||
|
||||
list = rpmReadHeaders (fd);
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ static PyObject * hdrLoad(PyObject * self, PyObject * args) {
|
|||
h->fileList = h->linkList = h->md5list = NULL;
|
||||
h->uids = h->gids = h->mtimes = h->fileSizes = NULL;
|
||||
h->modes = h->rdevs = NULL;
|
||||
|
||||
|
||||
return (PyObject *) h;
|
||||
}
|
||||
|
||||
|
@ -566,8 +566,8 @@ static PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args) {
|
|||
}
|
||||
|
||||
list = rpmReadHeaders (fd);
|
||||
fdClose(fd);
|
||||
|
||||
Fclose(fd);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ static void errorcb (void)
|
|||
{
|
||||
PyObject * result, * args = NULL;
|
||||
|
||||
if (errorData)
|
||||
if (errorData)
|
||||
args = Py_BuildValue("(O)", errorData);
|
||||
|
||||
result = PyEval_CallObject(errorCB, args);
|
||||
|
@ -602,15 +602,15 @@ static PyObject * errorSetCallback (PyObject * self, PyObject * args) {
|
|||
}
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|O", &errorCB, &errorData)) return NULL;
|
||||
|
||||
|
||||
if (!PyCallable_Check (errorCB)) {
|
||||
PyErr_SetString(PyExc_TypeError, "parameter must be callable");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Py_INCREF (errorCB);
|
||||
Py_XINCREF (errorData);
|
||||
|
||||
|
||||
rpmErrorSetCallback (errorcb);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
|
@ -623,7 +623,7 @@ static PyObject * errorString (PyObject * self, PyObject * args) {
|
|||
|
||||
static PyObject * versionCompare (PyObject * self, PyObject * args) {
|
||||
hdrObject * h1, * h2;
|
||||
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!O!", &hdrType, &h1, &hdrType, &h2)) return NULL;
|
||||
|
||||
return Py_BuildValue("i", rpmVersionCompare(h1->h, h2->h));
|
||||
|
@ -639,7 +639,7 @@ static PyObject * labelCompare (PyObject * self, PyObject * args) {
|
|||
|
||||
if (e1 && !e2)
|
||||
return Py_BuildValue("i", 1);
|
||||
else if (!e1 && e2)
|
||||
else if (!e1 && e2)
|
||||
return Py_BuildValue("i", -1);
|
||||
else if (e1 && e2) {
|
||||
int ep1, ep2;
|
||||
|
@ -650,7 +650,7 @@ static PyObject * labelCompare (PyObject * self, PyObject * args) {
|
|||
else if (ep1 > ep2)
|
||||
return Py_BuildValue("i", 1);
|
||||
}
|
||||
|
||||
|
||||
rc = rpmvercmp(v1, v2);
|
||||
if (rc)
|
||||
return Py_BuildValue("i", rc);
|
||||
|
@ -670,7 +670,7 @@ static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
|
|||
fd = fdDup(rawFd);
|
||||
|
||||
rc = rpmReadPackageHeader(fd, &header, &isSource, NULL, NULL);
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
switch (rc) {
|
||||
case 0:
|
||||
|
@ -808,7 +808,7 @@ static int rpmdbLength(rpmdbObject * s) {
|
|||
static hdrObject * rpmdbSubscript(rpmdbObject * s, PyObject * key) {
|
||||
int offset;
|
||||
hdrObject * h;
|
||||
|
||||
|
||||
if (!PyInt_Check(key)) {
|
||||
PyErr_SetString(PyExc_TypeError, "integer expected");
|
||||
return NULL;
|
||||
|
@ -827,7 +827,7 @@ static hdrObject * rpmdbSubscript(rpmdbObject * s, PyObject * key) {
|
|||
PyErr_SetString(pyrpmError, "cannot read rpmdb entry");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
|
@ -872,7 +872,7 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) {
|
|||
}
|
||||
|
||||
switch (tag) {
|
||||
case RPMTAG_FILENAMES:
|
||||
case RPMTAG_OLDFILENAMES:
|
||||
case RPMTAG_FILESIZES:
|
||||
case RPMTAG_FILESTATES:
|
||||
case RPMTAG_FILEMODES:
|
||||
|
@ -952,7 +952,7 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) {
|
|||
case RPM_STRING_TYPE:
|
||||
if (count != 1 || forceArray) {
|
||||
stringArray = data;
|
||||
|
||||
|
||||
metao = PyList_New(0);
|
||||
for (i=0; i < count; i++) {
|
||||
o = PyString_FromString(stringArray[i]);
|
||||
|
@ -1009,7 +1009,7 @@ static PyObject * hdrUnload(hdrObject * s, PyObject * args) {
|
|||
|
||||
len = headerSizeof(s->h, 0);
|
||||
buf = headerUnload(s->h);
|
||||
|
||||
|
||||
rc = PyString_FromStringAndSize(buf, len);
|
||||
free(buf);
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
if (!verifyResult) return list;
|
||||
|
||||
if (!s->fileList) {
|
||||
headerGetEntry(s->h, RPMTAG_FILENAMES, &type, (void **) &s->fileList,
|
||||
headerGetEntry(s->h, RPMTAG_OLDFILENAMES, &type, (void **) &s->fileList,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
@ -1058,14 +1058,14 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
|
||||
if (verifyResult & RPMVERIFY_MD5) {
|
||||
if (!s->md5list) {
|
||||
headerGetEntry(s->h, RPMTAG_FILEMD5S, &type, (void **) &s->md5list,
|
||||
headerGetEntry(s->h, RPMTAG_FILEMD5S, &type, (void **) &s->md5list,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
||||
if (mdfile(s->fileList[fileNumber], buf)) {
|
||||
strcpy(buf, "(unknown)");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tuple = PyTuple_New(3);
|
||||
attrName = PyString_FromString("checksum");
|
||||
PyTuple_SetItem(tuple, 0, attrName);
|
||||
|
@ -1076,7 +1076,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
|
||||
if (verifyResult & RPMVERIFY_FILESIZE) {
|
||||
if (!s->fileSizes) {
|
||||
headerGetEntry(s->h, RPMTAG_FILESIZES, &type, (void **) &s->fileSizes,
|
||||
headerGetEntry(s->h, RPMTAG_FILESIZES, &type, (void **) &s->fileSizes,
|
||||
&count);
|
||||
|
||||
}
|
||||
|
@ -1094,7 +1094,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
|
||||
if (verifyResult & RPMVERIFY_LINKTO) {
|
||||
if (!s->linkList) {
|
||||
headerGetEntry(s->h, RPMTAG_FILELINKTOS, &type, (void **) &s->linkList,
|
||||
headerGetEntry(s->h, RPMTAG_FILELINKTOS, &type, (void **) &s->linkList,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
|
||||
if (verifyResult & RPMVERIFY_MTIME) {
|
||||
if (!s->mtimes) {
|
||||
headerGetEntry(s->h, RPMTAG_FILEMTIMES, &type, (void **) &s->mtimes,
|
||||
headerGetEntry(s->h, RPMTAG_FILEMTIMES, &type, (void **) &s->mtimes,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
@ -1138,7 +1138,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
|
||||
if (verifyResult & RPMVERIFY_RDEV) {
|
||||
if (!s->rdevs) {
|
||||
headerGetEntry(s->h, RPMTAG_FILERDEVS, &type, (void **) &s->rdevs,
|
||||
headerGetEntry(s->h, RPMTAG_FILERDEVS, &type, (void **) &s->rdevs,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
doesn't do these correctly either. At least this is consisten */
|
||||
if (verifyResult & RPMVERIFY_USER) {
|
||||
if (!s->uids) {
|
||||
headerGetEntry(s->h, RPMTAG_FILEUIDS, &type, (void **) &s->uids,
|
||||
headerGetEntry(s->h, RPMTAG_FILEUIDS, &type, (void **) &s->uids,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
@ -1173,7 +1173,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
|
||||
if (verifyResult & RPMVERIFY_GROUP) {
|
||||
if (!s->gids) {
|
||||
headerGetEntry(s->h, RPMTAG_FILEGIDS, &type, (void **) &s->gids,
|
||||
headerGetEntry(s->h, RPMTAG_FILEGIDS, &type, (void **) &s->gids,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
@ -1189,7 +1189,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
|
|||
|
||||
if (verifyResult & RPMVERIFY_MODE) {
|
||||
if (!s->modes) {
|
||||
headerGetEntry(s->h, RPMTAG_FILEMODES, &type, (void **) &s->modes,
|
||||
headerGetEntry(s->h, RPMTAG_FILEMODES, &type, (void **) &s->modes,
|
||||
&count);
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ static void rpmtransDealloc(PyObject * o) {
|
|||
if (trans->dbo) {
|
||||
Py_DECREF(trans->dbo);
|
||||
}
|
||||
if (trans->scriptFd) fdClose(trans->scriptFd);
|
||||
if (trans->scriptFd) Fclose(trans->scriptFd);
|
||||
/* this will free the keyList, and decrement the ref count of all
|
||||
the items on the list as well :-) */
|
||||
Py_DECREF(trans->keyList);
|
||||
|
@ -1318,10 +1318,10 @@ static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) {
|
|||
list = PyList_New(0);
|
||||
|
||||
for (i = 0; i < numConflicts; i++) {
|
||||
cf = Py_BuildValue("((sss)(ss)iOi)", conflicts[i].byName,
|
||||
cf = Py_BuildValue("((sss)(ss)iOi)", conflicts[i].byName,
|
||||
conflicts[i].byVersion, conflicts[i].byRelease,
|
||||
|
||||
conflicts[i].needsName,
|
||||
conflicts[i].needsName,
|
||||
conflicts[i].needsVersion,
|
||||
|
||||
conflicts[i].needsFlags,
|
||||
|
@ -1347,7 +1347,7 @@ struct tsCallbackType {
|
|||
int pythonError;
|
||||
};
|
||||
|
||||
static void * tsCallback(const Header h, const rpmCallbackType what,
|
||||
static void * tsCallback(const Header h, const rpmCallbackType what,
|
||||
const unsigned long amount, const unsigned long total,
|
||||
const void * pkgKey, void * data) {
|
||||
struct tsCallbackType * cbInfo = data;
|
||||
|
@ -1379,7 +1379,7 @@ static void * tsCallback(const Header h, const rpmCallbackType what,
|
|||
}
|
||||
|
||||
if (what == RPMCALLBACK_INST_CLOSE_FILE) {
|
||||
fdClose (fdt);
|
||||
Fclose (fdt);
|
||||
}
|
||||
|
||||
Py_DECREF(result);
|
||||
|
@ -1395,16 +1395,16 @@ static PyObject * rpmtransRun(rpmtransObject * s, PyObject * args) {
|
|||
struct tsCallbackType cbInfo;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "iiOO", &flags, &ignoreSet, &cbInfo.cb,
|
||||
&cbInfo.data))
|
||||
&cbInfo.data))
|
||||
return NULL;
|
||||
|
||||
cbInfo.pythonError = 0;
|
||||
|
||||
rc = rpmRunTransactions(s->ts, tsCallback, &cbInfo, NULL, &probs, flags,
|
||||
rc = rpmRunTransactions(s->ts, tsCallback, &cbInfo, NULL, &probs, flags,
|
||||
ignoreSet);
|
||||
|
||||
if (cbInfo.pythonError) {
|
||||
if (rc > 0)
|
||||
if (rc > 0)
|
||||
rpmProblemSetFree(probs);
|
||||
return NULL;
|
||||
}
|
||||
|
|
4
rpm.c
4
rpm.c
|
@ -499,7 +499,7 @@ static void printHelp(void) {
|
|||
_("use <dir> as the top level directory"));
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
int main(int argc, const char ** argv)
|
||||
{
|
||||
enum modes bigMode = MODE_UNKNOWN;
|
||||
QVA_t *qva = &rpmQVArgs;
|
||||
|
@ -514,7 +514,7 @@ int main(int argc, char ** argv)
|
|||
char * tce;
|
||||
char * passPhrase = "";
|
||||
char * cookie = NULL;
|
||||
char * optArg;
|
||||
const char * optArg;
|
||||
pid_t pipeChild = 0;
|
||||
const char * pkg;
|
||||
char * errString = NULL;
|
||||
|
|
|
@ -42,18 +42,18 @@ int main(int argc, char **argv)
|
|||
|
||||
gzdi = gzdFdopen(fdi, "r"); /* XXX gzdi == fdi */
|
||||
|
||||
while ((ct = gzdRead(gzdi, &buffer, sizeof(buffer))) > 0) {
|
||||
fdWrite(fdo, &buffer, ct);
|
||||
while ((ct = Fread(buffer, sizeof(buffer), 1, gzdi)) > 0) {
|
||||
Fwrite(buffer, ct, 1, fdo);
|
||||
}
|
||||
|
||||
if (ct < 0) {
|
||||
fprintf (stderr, "rpm2cpio: zlib: %s\n", gzdStrerror(gzdi));
|
||||
fprintf (stderr, "rpm2cpio: zlib: %s\n", Fstrerror(gzdi));
|
||||
rc = EXIT_FAILURE;
|
||||
} else {
|
||||
rc = EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
gzdClose(gzdi); /* XXX gzdi == fdi */
|
||||
Fclose(gzdi); /* XXX gzdi == fdi */
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(isblank)
|
||||
#define isblank(_c) ((_c) == ' ' || (_c) == '\t')
|
||||
#endif
|
||||
#define iseol(_c) ((_c) == '\n' || (_c) == '\r')
|
||||
|
||||
#define STREQ(_t, _f, _fn) ((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn)))
|
||||
|
@ -25,8 +27,8 @@
|
|||
typedef int FD_t;
|
||||
#define fdFileno(_x) (_x)
|
||||
#define fdOpen open
|
||||
#define fdRead read
|
||||
#define fdClose close
|
||||
#define Fread(_b, _s, _n, _fd) read(_fd, _b, _s)
|
||||
#define Fclose(_fd) close(_fd)
|
||||
#else
|
||||
#include <rpmlib.h>
|
||||
#endif
|
||||
|
@ -1343,9 +1345,9 @@ int isCompressed(const char *file, int *compressed)
|
|||
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
nb = fdRead(fd, magic, sizeof(magic));
|
||||
nb = Fread(magic, sizeof(magic), 1, fd);
|
||||
rderrno = errno;
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
if (nb < 0) {
|
||||
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, strerror(rderrno));
|
||||
|
|
17
system.h
17
system.h
|
@ -233,6 +233,23 @@ char *__progname;
|
|||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIBIO_H
|
||||
#include <libio.h>
|
||||
#else
|
||||
typedef ssize_t cookie_read_function_t (void *cookie, void *buf, size_t nbytes);
|
||||
typedef ssize_t cookie_write_function_t (void *cookie, const void *buf, size_t nbytes);
|
||||
typedef int cookie_seek_function_t (void *cookie, fpos_t *pos, int whence);
|
||||
typedef int cookie_close_function_t (void *cookie);
|
||||
|
||||
typedef struct {
|
||||
cookie_read_function_t *read;
|
||||
cookie_write_function_t *write;
|
||||
cookie_seek_function_t *seek;
|
||||
cookie_close_function_t *close;
|
||||
} cookie_io_functions_t;
|
||||
|
||||
#endif
|
||||
|
||||
/* Take care of NLS matters. */
|
||||
|
||||
#if HAVE_LOCALE_H
|
||||
|
|
|
@ -24,7 +24,7 @@ int main(int argc, char ** argv)
|
|||
fprintf(stderr, _("headerRead error: %s\n"), strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
fdClose(fdi);
|
||||
Fclose(fdi);
|
||||
|
||||
headerDump(h, stdout, HEADER_DUMP_INLINE, rpmTagTable);
|
||||
headerFree(h);
|
||||
|
|
|
@ -27,8 +27,8 @@ int main(int argc, char **argv)
|
|||
HEADER_MAGIC_YES : HEADER_MAGIC_NO);
|
||||
|
||||
fdo = fdDup(STDOUT_FILENO);
|
||||
while ((ct = fdRead(fdi, &buffer, 1024))) {
|
||||
fdWrite(fdo, &buffer, ct);
|
||||
while ((ct = Fread(buffer, sizeof(buffer), 1, fdi))) {
|
||||
Fwrite(buffer, ct, 1, fdo);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -761,7 +761,7 @@ rewriteBinaryRPM(char *fni, char *fno, message_list_ty *mlp)
|
|||
DPRINTF(99, ("rewriteBinaryRPM(\"%s\",\"%s\",%p)\n", fni, fno, mlp));
|
||||
|
||||
csa->cpioArchiveSize = 0;
|
||||
csa->cpioFdIn = fdNew();
|
||||
csa->cpioFdIn = fdNew(&fdio);
|
||||
csa->cpioList = NULL;
|
||||
csa->cpioCount = 0;
|
||||
csa->lead = &lead; /* XXX FIXME: exorcize lead/arch/os */
|
||||
|
@ -784,7 +784,7 @@ rewriteBinaryRPM(char *fni, char *fno, message_list_ty *mlp)
|
|||
}
|
||||
|
||||
exit:
|
||||
fdClose(csa->cpioFdIn);
|
||||
Fclose(csa->cpioFdIn);
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
@ -847,7 +847,7 @@ rpmgettext(FD_t fd, const char *file, FILE *ofp)
|
|||
|
||||
if (ofp != stdout)
|
||||
fclose(ofp);
|
||||
fdClose(fd);
|
||||
Fclose(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -444,7 +444,7 @@ rewriteRPM(const char *fni, const char *fno, cmd_t *cmds[], int ncmds)
|
|||
int rc;
|
||||
|
||||
csa->cpioArchiveSize = 0;
|
||||
csa->cpioFdIn = fdNew();
|
||||
csa->cpioFdIn = fdNew(&fdio);
|
||||
csa->cpioList = NULL;
|
||||
csa->cpioCount = 0;
|
||||
csa->lead = &lead; /* XXX FIXME: exorcize lead/arch/os */
|
||||
|
@ -467,7 +467,7 @@ rewriteRPM(const char *fni, const char *fno, cmd_t *cmds[], int ncmds)
|
|||
}
|
||||
|
||||
exit:
|
||||
fdClose(csa->cpioFdIn);
|
||||
Fclose(csa->cpioFdIn);
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue