summaryrefslogtreecommitdiff
path: root/build/parsePreamble.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-11-12 17:20:49 +0000
committerjbj <devnull@localhost>1999-11-12 17:20:49 +0000
commit8ce88756fdb4a1cd88085acfac49c3a7180bb1bb (patch)
tree02f06c8b54b20af60f42299f65a6fca86cd61783 /build/parsePreamble.c
parente0b1d0be3607ef673555ca17078bfff6f854267e (diff)
downloadlibrpm-tizen-8ce88756fdb4a1cd88085acfac49c3a7180bb1bb.tar.gz
librpm-tizen-8ce88756fdb4a1cd88085acfac49c3a7180bb1bb.tar.bz2
librpm-tizen-8ce88756fdb4a1cd88085acfac49c3a7180bb1bb.zip
Use Fstrerror on ufdio throughut.
rpm.c: add --rmspec to usage output. build/files.c: use ufdio to permit '%files -f <url>' (untested). build/pack.c: use ufdio in readRPM(), writeRPM(), and addFileToTag(). build/parsePreamble.c: use ufdio in readIcon(). lib/ftp.c: httpOpen() now takes FD_t ctrl arg to uncouple from u->ctrl. lib/install.c: usr rpmGenPath() to identify first found url in file path concat. lib/install.c: permit url's in files[i].relativePath. lib/macro.c: use ufdio, diddle macros for tmacro standalone build. lib/macro.c: Create rpmGenPath(). lib/macro.c: diddle macro files path to permit url's. lib/rpmchecksig.c: use Fopen on fdio. lib/rpmio.c: replace copyData() with ufdCopy(). lib/rpmio.c: replace httpGetFile() with ufdGetFile(). lib/rpmio.c: add ufdWrite(). lib/rpmio.c: permit 2 simultaneous persistent malloc/open HTTP/1.1 connections. lib/rpmio.c: Add Lstat(), Stat(), and Access(). lib/rpmio.c: assume paths in syscall stubs are loopback (WRONG). lib/url.c: add urlPath(). CVS patchset: 3422 CVS date: 1999/11/12 17:20:49
Diffstat (limited to 'build/parsePreamble.c')
-rw-r--r--build/parsePreamble.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 5299deb6b..ec9486620 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -231,12 +231,13 @@ static int readIcon(Header h, const char *file)
char *icon;
struct stat statbuf;
FD_t fd;
- int rc;
+ int rc = 0;
int nb;
+ /* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
fn = rpmGetPath("%{_sourcedir}/", file, NULL);
- if (stat(fn, &statbuf)) {
+ if (Stat(fn, &statbuf)) {
rpmError(RPMERR_BADSPEC, _("Unable to stat icon: %s"), fn);
rc = RPMERR_BADSPEC;
goto exit;
@@ -244,16 +245,23 @@ static int readIcon(Header h, const char *file)
icon = xmalloc(statbuf.st_size);
*icon = '\0';
- fd = Fopen(fn, "r.fdio");
- /* XXX Fstrerror */
- /* XXX Ferror check */
+
+ fd = Fopen(fn, "r.ufdio");
+ if (fd == NULL || Ferror(fd)) {
+ rpmError(RPMERR_BADSPEC, _("Unable to open icon %s: %s"),
+ fn, Fstrerror(fd));
+ rc = RPMERR_BADSPEC;
+ goto exit;
+ }
nb = Fread(icon, sizeof(char), statbuf.st_size, fd);
- Fclose(fd);
if (nb != statbuf.st_size) {
- rpmError(RPMERR_BADSPEC, _("Unable to read icon: %s"), fn);
+ rpmError(RPMERR_BADSPEC, _("Unable to read icon %s: %s"),
+ fn, Fstrerror(fd));
rc = RPMERR_BADSPEC;
- goto exit;
}
+ Fclose(fd);
+ if (rc)
+ goto exit;
if (! strncmp(icon, "GIF", sizeof("GIF")-1)) {
headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, statbuf.st_size);
@@ -264,8 +272,7 @@ static int readIcon(Header h, const char *file)
rc = RPMERR_BADSPEC;
goto exit;
}
- free(icon);
- rc = 0;
+ xfree(icon);
exit:
FREE(fn);
@@ -387,7 +394,9 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro,
case RPMTAG_BUILDROOT:
SINGLE_TOKEN_ONLY;
if (spec->buildRoot == NULL) {
+ /* XXX use rpmGenPath(rootdir, "%{buildroot}/", file) for buildroot path. */
const char *buildroot = rpmGetPath("%{buildroot}", NULL);
+ /* XXX FIXME make sure that buildroot has path, add urlbuildroot. */
if (buildroot && *buildroot != '%') {
spec->buildRoot = xstrdup(cleanFileName(buildroot));
macro = NULL;