Commit 40417e64 authored by Michal Čihař's avatar Michal Čihař

Imported Upstream version 4.11.0.1

parent cb1349f7
This diff is collapsed.
......@@ -9,7 +9,7 @@ The libmagic (aka file) library for file type detection (used by rpmbuild).
The source for the file utility + library is available from
ftp://ftp.astron.com/pub/file/
The NSS library for encryption, and NSPR library which NSS uses.
The NSS >= 3.12 library for encryption, and NSPR library which NSS uses.
Both NSPR and NSS libraries and headers need to be installed during RPM
compilation. As NSPR and NSS typically install their headers outside
the regular include search path, you need to tell configure about this,
......
......@@ -58,6 +58,7 @@ pkginclude_HEADERS += rpmio/rpmlog.h
pkginclude_HEADERS += rpmio/rpmpgp.h
pkginclude_HEADERS += rpmio/rpmsq.h
pkginclude_HEADERS += rpmio/rpmstring.h
pkginclude_HEADERS += rpmio/rpmstrpool.h
pkginclude_HEADERS += rpmio/rpmsw.h
pkginclude_HEADERS += rpmio/rpmfileutil.h
pkginclude_HEADERS += rpmio/rpmutil.h
......
......@@ -394,6 +394,8 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WITH_ACL_LIB = @WITH_ACL_LIB@
WITH_BEECRYPT_INCLUDE = @WITH_BEECRYPT_INCLUDE@
WITH_BEECRYPT_LIB = @WITH_BEECRYPT_LIB@
WITH_BZ2_LIB = @WITH_BZ2_LIB@
WITH_CAP_LIB = @WITH_CAP_LIB@
WITH_DB_LIB = @WITH_DB_LIB@
......@@ -417,6 +419,7 @@ YACC = @YACC@
YFLAGS = @YFLAGS@
__7ZIP = @__7ZIP@
__BZIP2 = @__BZIP2@
__BZR = @__BZR@
__CAT = @__CAT@
__CC = @__CC@
__CHGRP = @__CHGRP@
......@@ -427,9 +430,11 @@ __CPIO = @__CPIO@
__CURL = @__CURL@
__FAKECHROOT = @__FAKECHROOT@
__FILE = @__FILE@
__GIT = @__GIT@
__GPG = @__GPG@
__GREP = @__GREP@
__GZIP = @__GZIP@
__HG = @__HG@
__ID = @__ID@
__INSTALL = @__INSTALL@
__LD = @__LD@
......@@ -446,6 +451,7 @@ __PATCH = @__PATCH@
__PERL = @__PERL@
__PGP = @__PGP@
__PYTHON = @__PYTHON@
__QUILT = @__QUILT@
__RESTORECON = @__RESTORECON@
__RM = @__RM@
__RSH = @__RSH@
......@@ -528,16 +534,16 @@ CLEANFILES = rpmrc.tmp rpmrc macros platform.tmp platform rpm.pc.tmp \
include/rpm/argv.h include/rpm/rpmio.h include/rpm/rpmurl.h \
include/rpm/rpmmacro.h include/rpm/rpmlog.h \
include/rpm/rpmpgp.h include/rpm/rpmsq.h \
include/rpm/rpmstring.h include/rpm/rpmsw.h \
include/rpm/rpmfileutil.h include/rpm/rpmutil.h \
include/rpm/rpmkeyring.h include/rpm/rpmbase64.h \
include/rpm/header.h include/rpm/rpmdb.h \
include/rpm/rpmcallback.h include/rpm/rpmcli.h \
include/rpm/rpmlib.h include/rpm/rpmds.h include/rpm/rpmfi.h \
include/rpm/rpmlegacy.h include/rpm/rpmpol.h \
include/rpm/rpmps.h include/rpm/rpmprob.h include/rpm/rpmtag.h \
include/rpm/rpmtd.h include/rpm/rpmte.h include/rpm/rpmts.h \
include/rpm/rpmtypes.h include/rpm/rpmvf.h \
include/rpm/rpmstring.h include/rpm/rpmstrpool.h \
include/rpm/rpmsw.h include/rpm/rpmfileutil.h \
include/rpm/rpmutil.h include/rpm/rpmkeyring.h \
include/rpm/rpmbase64.h include/rpm/header.h \
include/rpm/rpmdb.h include/rpm/rpmcallback.h \
include/rpm/rpmcli.h include/rpm/rpmlib.h include/rpm/rpmds.h \
include/rpm/rpmfi.h include/rpm/rpmlegacy.h \
include/rpm/rpmpol.h include/rpm/rpmps.h include/rpm/rpmprob.h \
include/rpm/rpmtag.h include/rpm/rpmtd.h include/rpm/rpmte.h \
include/rpm/rpmts.h include/rpm/rpmtypes.h include/rpm/rpmvf.h \
include/rpm/rpmsign.h include/rpm/rpmbuild.h \
include/rpm/rpmfc.h include/rpm/rpmspec.h
EXTRA_DIST = CHANGES ChangeLog CREDITS GROUPS INSTALL autodeps \
......@@ -549,16 +555,16 @@ BUILT_SOURCES = $(am__append_10) include/rpm/argv.h \
include/rpm/rpmio.h include/rpm/rpmurl.h \
include/rpm/rpmmacro.h include/rpm/rpmlog.h \
include/rpm/rpmpgp.h include/rpm/rpmsq.h \
include/rpm/rpmstring.h include/rpm/rpmsw.h \
include/rpm/rpmfileutil.h include/rpm/rpmutil.h \
include/rpm/rpmkeyring.h include/rpm/rpmbase64.h \
include/rpm/header.h include/rpm/rpmdb.h \
include/rpm/rpmcallback.h include/rpm/rpmcli.h \
include/rpm/rpmlib.h include/rpm/rpmds.h include/rpm/rpmfi.h \
include/rpm/rpmlegacy.h include/rpm/rpmpol.h \
include/rpm/rpmps.h include/rpm/rpmprob.h include/rpm/rpmtag.h \
include/rpm/rpmtd.h include/rpm/rpmte.h include/rpm/rpmts.h \
include/rpm/rpmtypes.h include/rpm/rpmvf.h \
include/rpm/rpmstring.h include/rpm/rpmstrpool.h \
include/rpm/rpmsw.h include/rpm/rpmfileutil.h \
include/rpm/rpmutil.h include/rpm/rpmkeyring.h \
include/rpm/rpmbase64.h include/rpm/header.h \
include/rpm/rpmdb.h include/rpm/rpmcallback.h \
include/rpm/rpmcli.h include/rpm/rpmlib.h include/rpm/rpmds.h \
include/rpm/rpmfi.h include/rpm/rpmlegacy.h \
include/rpm/rpmpol.h include/rpm/rpmps.h include/rpm/rpmprob.h \
include/rpm/rpmtag.h include/rpm/rpmtd.h include/rpm/rpmte.h \
include/rpm/rpmts.h include/rpm/rpmtypes.h include/rpm/rpmvf.h \
include/rpm/rpmsign.h include/rpm/rpmbuild.h \
include/rpm/rpmfc.h include/rpm/rpmspec.h
SUBDIRS = po misc $(am__append_1) $(am__append_2) rpmio lib sign build \
......@@ -574,13 +580,14 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) \
-DLIBRPMALIAS_FILENAME="\"rpmpopt-${VERSION}\""
pkginclude_HEADERS = rpmio/argv.h rpmio/rpmio.h rpmio/rpmurl.h \
rpmio/rpmmacro.h rpmio/rpmlog.h rpmio/rpmpgp.h rpmio/rpmsq.h \
rpmio/rpmstring.h rpmio/rpmsw.h rpmio/rpmfileutil.h \
rpmio/rpmutil.h rpmio/rpmkeyring.h rpmio/rpmbase64.h \
lib/header.h lib/rpmdb.h lib/rpmcallback.h lib/rpmcli.h \
lib/rpmlib.h lib/rpmds.h lib/rpmfi.h lib/rpmlegacy.h \
lib/rpmpol.h lib/rpmps.h lib/rpmprob.h lib/rpmtag.h \
lib/rpmtd.h lib/rpmte.h lib/rpmts.h lib/rpmtypes.h lib/rpmvf.h \
sign/rpmsign.h build/rpmbuild.h build/rpmfc.h build/rpmspec.h
rpmio/rpmstring.h rpmio/rpmstrpool.h rpmio/rpmsw.h \
rpmio/rpmfileutil.h rpmio/rpmutil.h rpmio/rpmkeyring.h \
rpmio/rpmbase64.h lib/header.h lib/rpmdb.h lib/rpmcallback.h \
lib/rpmcli.h lib/rpmlib.h lib/rpmds.h lib/rpmfi.h \
lib/rpmlegacy.h lib/rpmpol.h lib/rpmps.h lib/rpmprob.h \
lib/rpmtag.h lib/rpmtd.h lib/rpmte.h lib/rpmts.h \
lib/rpmtypes.h lib/rpmvf.h sign/rpmsign.h build/rpmbuild.h \
build/rpmfc.h build/rpmspec.h
nodist_pkginclude_HEADERS =
rpmbindir = `echo $(bindir) | $(SED) -e s,usr/bin,bin,`
rpmconfig_SCRIPTS = autodeps/find-provides autodeps/find-requires \
......@@ -1813,6 +1820,8 @@ include/rpm/rpmsq.h: rpmio/rpmsq.h include/rpm/$(dirstamp)
$(INSTALL_DATA) $(top_srcdir)/rpmio/rpmsq.h include/rpm/rpmsq.h
include/rpm/rpmstring.h: rpmio/rpmstring.h include/rpm/$(dirstamp)
$(INSTALL_DATA) $(top_srcdir)/rpmio/rpmstring.h include/rpm/rpmstring.h
include/rpm/rpmstrpool.h: rpmio/rpmstrpool.h include/rpm/$(dirstamp)
$(INSTALL_DATA) $(top_srcdir)/rpmio/rpmstrpool.h include/rpm/rpmstrpool.h
include/rpm/rpmsw.h: rpmio/rpmsw.h include/rpm/$(dirstamp)
$(INSTALL_DATA) $(top_srcdir)/rpmio/rpmsw.h include/rpm/rpmsw.h
include/rpm/rpmfileutil.h: rpmio/rpmfileutil.h include/rpm/$(dirstamp)
......
......@@ -16,7 +16,7 @@ librpmbuild_la_SOURCES = \
parsePolicies.c policies.c \
rpmbuild_internal.h rpmbuild_misc.h
librpmbuild_la_LDFLAGS = -version-info 3:3:0
librpmbuild_la_LDFLAGS = -version-info 4:0:1
librpmbuild_la_LIBADD = \
$(top_builddir)/lib/librpm.la \
$(top_builddir)/rpmio/librpmio.la \
......
......@@ -260,6 +260,8 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WITH_ACL_LIB = @WITH_ACL_LIB@
WITH_BEECRYPT_INCLUDE = @WITH_BEECRYPT_INCLUDE@
WITH_BEECRYPT_LIB = @WITH_BEECRYPT_LIB@
WITH_BZ2_LIB = @WITH_BZ2_LIB@
WITH_CAP_LIB = @WITH_CAP_LIB@
WITH_DB_LIB = @WITH_DB_LIB@
......@@ -283,6 +285,7 @@ YACC = @YACC@
YFLAGS = @YFLAGS@
__7ZIP = @__7ZIP@
__BZIP2 = @__BZIP2@
__BZR = @__BZR@
__CAT = @__CAT@
__CC = @__CC@
__CHGRP = @__CHGRP@
......@@ -293,9 +296,11 @@ __CPIO = @__CPIO@
__CURL = @__CURL@
__FAKECHROOT = @__FAKECHROOT@
__FILE = @__FILE@
__GIT = @__GIT@
__GPG = @__GPG@
__GREP = @__GREP@
__GZIP = @__GZIP@
__HG = @__HG@
__ID = @__ID@
__INSTALL = @__INSTALL@
__LD = @__LD@
......@@ -312,6 +317,7 @@ __PATCH = @__PATCH@
__PERL = @__PERL@
__PGP = @__PGP@
__PYTHON = @__PYTHON@
__QUILT = @__QUILT@
__RESTORECON = @__RESTORECON@
__RM = @__RM@
__RSH = @__RSH@
......@@ -394,7 +400,7 @@ librpmbuild_la_SOURCES = \
parsePolicies.c policies.c \
rpmbuild_internal.h rpmbuild_misc.h
librpmbuild_la_LDFLAGS = -version-info 3:3:0
librpmbuild_la_LDFLAGS = -version-info 4:0:1
librpmbuild_la_LIBADD = \
$(top_builddir)/lib/librpm.la \
$(top_builddir)/rpmio/librpmio.la \
......
This diff is collapsed.
......@@ -10,15 +10,12 @@
#include <time.h>
#include <rpm/rpmlib.h> /* RPMSIGTAG*, rpmReadPackageFile */
#include <rpm/rpmts.h>
#include <rpm/rpmfileutil.h>
#include <rpm/rpmlog.h>
#include "rpmio/rpmio_internal.h" /* fdInitDigest, fdFiniDigest */
#include "lib/cpio.h"
#include "lib/fsm.h"
#include "lib/rpmfi_internal.h" /* rpmfiFSM() */
#include "lib/rpmte_internal.h" /* rpmfs */
#include "lib/cpio.h"
#include "lib/signature.h"
#include "lib/rpmlead.h"
#include "build/rpmbuild_internal.h"
......@@ -36,46 +33,29 @@ typedef struct cpioSourceArchive_s {
*/
static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro)
{
rpmts ts = NULL;
rpmfi fi = csa->cpioList;
rpmte te = NULL;
rpmfs fs = NULL;
char *failedFile = NULL;
FD_t cfd;
int i, fsmrc;
int fsmrc;
(void) Fflush(fdo);
cfd = Fdopen(fdDup(Fileno(fdo)), fmodeMacro);
if (cfd == NULL)
return RPMRC_FAIL;
/* make up a transaction element for passing to fsm */
ts = rpmtsCreate();
rpmtsAddInstallElement(ts, h, NULL, 0, NULL);
te = rpmtsElement(ts, 0);
fs = rpmteGetFileStates(te);
fi = rpmfiInit(fi, 0);
while ((i = rpmfiNext(fi)) >= 0) {
if (rpmfiFFlags(fi) & RPMFILE_GHOST)
rpmfsSetAction(fs, i, FA_SKIP);
else
rpmfsSetAction(fs, i, FA_COPYOUT);
}
fsmrc = rpmfsmRun(FSM_PKGBUILD, ts, te, fi, cfd, NULL,
fsmrc = rpmPackageFilesArchive(csa->cpioList, headerIsSource(h), cfd,
&csa->cpioArchiveSize, &failedFile);
if (fsmrc) {
if (failedFile)
rpmlog(RPMLOG_ERR, _("create archive failed on file %s\n"), failedFile);
rpmlog(RPMLOG_ERR, _("create archive failed on file %s: %s\n"),
failedFile, rpmcpioStrerror(fsmrc));
else
rpmlog(RPMLOG_ERR, _("create archive failed\n"));
rpmlog(RPMLOG_ERR, _("create archive failed: %s\n"),
rpmcpioStrerror(fsmrc));
}
free(failedFile);
Fclose(cfd);
rpmtsFree(ts);
return (fsmrc == 0) ? RPMRC_OK : RPMRC_FAIL;
}
......
......@@ -22,6 +22,14 @@ static void addChangelogEntry(Header h, time_t time, const char *name, const cha
headerPutString(h, RPMTAG_CHANGELOGTEXT, text);
}
static int sameDate(const struct tm *ot, const struct tm *nt)
{
return (ot->tm_year == nt->tm_year &&
ot->tm_mon == nt->tm_mon &&
ot->tm_mday == nt->tm_mday &&
ot->tm_wday == nt->tm_wday);
}
/**
* Parse date string to seconds.
* @param datestr date string (e.g. 'Wed Jan 1 1997')
......@@ -31,7 +39,7 @@ static void addChangelogEntry(Header h, time_t time, const char *name, const cha
static int dateToTimet(const char * datestr, time_t * secs)
{
int rc = -1; /* assume failure */
struct tm time;
struct tm time, ntime;
const char * const * idx;
char *p, *pe, *q, *date, *tz;
......@@ -44,6 +52,7 @@ static int dateToTimet(const char * datestr, time_t * secs)
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
memset(&time, 0, sizeof(time));
memset(&ntime, 0, sizeof(ntime));
date = xstrdup(datestr);
pe = date;
......@@ -55,6 +64,7 @@ static int dateToTimet(const char * datestr, time_t * secs)
for (idx = days; *idx && !rstreq(*idx, p); idx++)
{};
if (*idx == NULL) goto exit;
time.tm_wday = idx - days;
/* month */
p = pe; SKIPSPACE(p);
......@@ -90,7 +100,8 @@ static int dateToTimet(const char * datestr, time_t * secs)
tz = getenv("TZ");
if (tz) tz = xstrdup(tz);
setenv("TZ", "UTC", 1);
*secs = mktime(&time);
ntime = time; /* struct assignment */
*secs = mktime(&ntime);
unsetenv("TZ");
if (tz) {
setenv("TZ", tz, 1);
......@@ -98,6 +109,10 @@ static int dateToTimet(const char * datestr, time_t * secs)
}
if (*secs == -1) goto exit;
/* XXX Turn this into a hard error in a release or two */
if (!sameDate(&time, &ntime))
rpmlog(RPMLOG_WARNING, _("bogus date in %%changelog: %s\n"), datestr);
rc = 0;
exit:
......
......@@ -26,6 +26,9 @@ int parseFiles(rpmSpec spec)
{ 0, 0, 0, 0, 0, NULL, NULL}
};
/* XXX unmask %license while parsing %files */
addMacro(spec->macros, "license", NULL, "%%license", RMIL_SPEC);
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmlog(RPMLOG_ERR, _("line %d: Error parsing %%files: %s\n"),
spec->lineNum, poptStrerror(rc));
......@@ -92,6 +95,7 @@ int parseFiles(rpmSpec spec)
res = nextPart;
exit:
delMacro(NULL, "license");
free(argv);
poptFreeContext(optCon);
......
......@@ -333,7 +333,6 @@ typedef const struct tokenBits_s {
*/
static struct tokenBits_s const installScriptBits[] = {
{ "interp", RPMSENSE_INTERP },
{ "prereq", RPMSENSE_PREREQ },
{ "preun", RPMSENSE_SCRIPT_PREUN },
{ "pre", RPMSENSE_SCRIPT_PRE },
{ "postun", RPMSENSE_SCRIPT_POSTUN },
......@@ -536,30 +535,6 @@ static void fillOutMainPackage(Header h)
}
}
static int getSpecialDocDir(Package pkg)
{
const char *errstr, *docdir_fmt = "%{NAME}-%{VERSION}";
char *fmt_macro, *fmt;
int rc = -1;
fmt_macro = rpmExpand("%{?_docdir_fmt}", NULL);
if (fmt_macro && strlen(fmt_macro) > 0) {
docdir_fmt = fmt_macro;
}
fmt = headerFormat(pkg->header, docdir_fmt, &errstr);
if (!fmt) {
rpmlog(RPMLOG_ERR, _("illegal _docdir_fmt: %s\n"), errstr);
goto exit;
}
pkg->specialDocDir = rpmGetPath("%{_docdir}/", fmt, NULL);
rc = 0;
exit:
free(fmt);
free(fmt_macro);
return rc;
}
/**
*/
static rpmRC readIcon(Header h, const char * file)
......@@ -798,15 +773,13 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
break;
case RPMTAG_ORDERFLAGS:
case RPMTAG_REQUIREFLAGS:
case RPMTAG_PREREQ:
if (parseBits(lang, installScriptBits, &tagflags)) {
rpmlog(RPMLOG_ERR, _("line %d: Bad %s: qualifiers: %s\n"),
spec->lineNum, rpmTagGetName(tag), spec->line);
goto exit;
}
if (parseRCPOT(spec, pkg, field, tag, 0, tagflags))
goto exit;
break;
/* fallthrough */
case RPMTAG_PREREQ:
case RPMTAG_BUILDPREREQ:
case RPMTAG_BUILDREQUIRES:
case RPMTAG_BUILDCONFLICTS:
......@@ -1110,10 +1083,6 @@ int parsePreamble(rpmSpec spec, int initialPackage)
goto exit;
}
if (getSpecialDocDir(pkg)) {
goto exit;
}
/* if we get down here nextPart has been set to non-error */
res = nextPart;
......
......@@ -29,7 +29,7 @@ typedef struct OpenFileInfo {
FILE *fp;
int lineNum;
char readBuf[BUFSIZ];
char * readPtr;
const char * readPtr;
struct OpenFileInfo * next;
} OFI_t;
......@@ -109,31 +109,35 @@ void handleComments(char *s)
*s = '\0';
}
static struct OpenFileInfo * newOpenFileInfo(void)
/* Push a file to spec's file stack, return the newly pushed entry */
static OFI_t * pushOFI(rpmSpec spec, const char *fn)
{
struct OpenFileInfo *ofi;
OFI_t *ofi = xcalloc(1, sizeof(*ofi));
ofi = xmalloc(sizeof(*ofi));
ofi->fp = NULL;
ofi->fileName = NULL;
ofi->fileName = xstrdup(fn);
ofi->lineNum = 0;
ofi->readBuf[0] = '\0';
ofi->readPtr = NULL;
ofi->next = NULL;
ofi->next = spec->fileStack;
return ofi;
spec->fileStack = ofi;
return spec->fileStack;
}
/**
*/
static void forceIncludeFile(rpmSpec spec, const char * fileName)
/* Pop from spec's file stack */
static OFI_t * popOFI(rpmSpec spec)
{
OFI_t * ofi;
if (spec->fileStack) {
OFI_t * ofi = spec->fileStack;
ofi = newOpenFileInfo();
ofi->fileName = xstrdup(fileName);
ofi->next = spec->fileStack;
spec->fileStack = ofi;
spec->fileStack = ofi->next;
if (ofi->fp)
fclose(ofi->fp);
free(ofi->fileName);
free(ofi);
}
return spec->fileStack;
}
static int restoreFirstChar(rpmSpec spec)
......@@ -150,23 +154,25 @@ static int restoreFirstChar(rpmSpec spec)
/* Return zero on success, 1 if we need to read more and -1 on errors. */
static int copyNextLineFromOFI(rpmSpec spec, OFI_t *ofi)
{
char ch;
/* Expand next line from file into line buffer */
if (!(spec->nextline && *spec->nextline)) {
int pc = 0, bc = 0, nc = 0;
char *from, *to, *p;
to = spec->lbufPtr ? spec->lbufPtr : spec->lbuf;
from = ofi->readPtr;
ch = ' ';
while (from && *from && ch != '\n')
ch = *to++ = *from++;
spec->lbufPtr = to;
*to = '\0';
const char *from = ofi->readPtr;
char ch = ' ';
while (from && *from && ch != '\n') {
ch = spec->lbuf[spec->lbufOff] = *from;
spec->lbufOff++; from++;
if (spec->lbufOff >= spec->lbufSize) {
spec->lbufSize += BUFSIZ;
spec->lbuf = realloc(spec->lbuf, spec->lbufSize);
}
}
spec->lbuf[spec->lbufOff] = '\0';
ofi->readPtr = from;
/* Check if we need another line before expanding the buffer. */
for (p = spec->lbuf; *p; p++) {
for (const char *p = spec->lbuf; *p; p++) {
switch (*p) {
case '\\':
switch (*(p+1)) {
......@@ -195,11 +201,11 @@ static int copyNextLineFromOFI(rpmSpec spec, OFI_t *ofi)
spec->nextline = "";
return 1;
}
spec->lbufPtr = spec->lbuf;
spec->lbufOff = 0;
/* Don't expand macros (eg. %define) in false branch of %if clause */
if (spec->readStack->reading &&
expandMacros(spec, spec->macros, spec->lbuf, sizeof(spec->lbuf))) {
expandMacros(spec, spec->macros, spec->lbuf, spec->lbufSize)) {
rpmlog(RPMLOG_ERR, _("line %d: %s\n"),
spec->lineNum, spec->lbuf);
return -1;
......@@ -254,13 +260,9 @@ retry:
if (!(ofi->readPtr && *(ofi->readPtr))) {
if (!fgets(ofi->readBuf, BUFSIZ, ofi->fp)) {
/* EOF, remove this file from the stack */
spec->fileStack = ofi->next;
fclose(ofi->fp);
free(ofi->fileName);
free(ofi);
ofi = popOFI(spec);
/* only on last file do we signal EOF to caller */
ofi = spec->fileStack;
if (ofi == NULL)
return 1;
......@@ -386,15 +388,14 @@ int readLine(rpmSpec spec, int strip)
SKIPNONSPACE(endFileName);
p = endFileName;
SKIPSPACE(p);
if (*p != '\0') {
rpmlog(RPMLOG_ERR, _("malformed %%include statement\n"));
if (*fileName == '\0' || *p != '\0') {
rpmlog(RPMLOG_ERR, _("%s:%d: malformed %%include statement\n"),
ofi->fileName, ofi->lineNum);
return PART_ERROR;
}
*endFileName = '\0';
forceIncludeFile(spec, fileName);