Swap 2nd and 3rd arg to Fread/Fwrite to preserve read/write type return.
authorjbj <devnull@localhost>
Wed, 10 Nov 1999 22:09:49 +0000 (22:09 +0000)
committerjbj <devnull@localhost>
Wed, 10 Nov 1999 22:09:49 +0000 (22:09 +0000)
Use Fstrerror to retrieve fd->syserrno.
Make ftpFileDoneNeeded per-fd rather than per-url.
Make data fd unique rather than per-url.
Use appropriate protocol commands for ufdio writing.

CVS patchset: 3421
CVS date: 1999/11/10 22:09:49

26 files changed:
build.c
build/files.c
build/pack.c
build/parsePreamble.c
lib/cpio.c
lib/falloc.c
lib/ftp.c
lib/header.c
lib/macro.c
lib/misc.c
lib/oldheader.c
lib/query.c
lib/rpmchecksig.c
lib/rpmdb.c
lib/rpminstall.c
lib/rpmio.h
lib/rpmlead.c
lib/rpmrc.c
lib/rpmurl.h
lib/signature.c
lib/tufdio.c
lib/uninstall.c
lib/url.c
po/rpm.pot
rpm2cpio.c
rpmio/macro.c

diff --git a/build.c b/build.c
index 2bfebb0..654f5b2 100644 (file)
--- a/build.c
+++ b/build.c
@@ -62,10 +62,10 @@ static int isSpecFile(const char *specfile)
     fd = Fopen(specfile, "r.ufdio");
     if (Ferror(fd)) {
        /* XXX Fstrerror */
-       fprintf(stderr, _("Unable to open spec file: %s\n"), specfile);
+       fprintf(stderr, _("Unable to open spec file %s: %s\n"), specfile, Fstrerror(fd));
        return 0;
     }
-    count = Fread(buf, sizeof(buf), 1, fd);
+    count = Fread(buf, sizeof(buf[0]), sizeof(buf), fd);
     Fclose(fd);
 
     checking = 1;
index 156b602..5f213ed 100644 (file)
@@ -1582,6 +1582,7 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
        }
        
        execvp(argv[0], argv);
+       /* XXX this error message is probably not seen. */
        rpmError(RPMERR_EXEC, _("Couldn't exec %s: %s"),
                argv[0], strerror(errno));
        _exit(RPMERR_EXEC);
index 5ac6507..a75dba9 100644 (file)
@@ -181,9 +181,8 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
     if (fileName != NULL) {
        fdi = Fopen(fileName, "r.fdio");
        if (Ferror(fdi)) {
-           /* XXX Fstrerror */
            rpmError(RPMERR_BADMAGIC, _("readRPM: open %s: %s\n"), fileName,
-               strerror(errno));
+               Fstrerror(fdi));
            return RPMERR_BADMAGIC;
        }
     } else {
@@ -191,9 +190,9 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
     }
 
     /* Get copy of lead */
-    if ((rc = Fread(lead, sizeof(*lead), 1, fdi)) != sizeof(*lead)) {
+    if ((rc = Fread(lead, sizeof(char), sizeof(*lead), fdi)) != sizeof(*lead)) {
        rpmError(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"), fileName,
-           strerror(errno));
+           Fstrerror(fdi));
        return RPMERR_BADMAGIC;
     }
 
@@ -310,8 +309,7 @@ int writeRPM(Header h, const char *fileName, int type,
     /* Open the output file */
     fd = Fopen(fileName, "w.fdio");
     if (Ferror(fd)) {
-       /* XXX Fstrerror */
-       rpmError(RPMERR_CREATE, _("Could not open %s\n"), fileName);
+       rpmError(RPMERR_CREATE, _("Could not open %s: %s\n"), fileName, Fstrerror(fd));
        unlink(sigtarget);
        xfree(sigtarget);
        return RPMERR_CREATE;
@@ -344,7 +342,7 @@ int writeRPM(Header h, const char *fileName, int type,
     strncpy(lead.name, buf, sizeof(lead.name));
     if (writeLead(fd, &lead)) {
        rpmError(RPMERR_NOSPACE, _("Unable to write package: %s"),
-                strerror(errno));
+                Fstrerror(fd));
        Fclose(fd);
        unlink(sigtarget);
        xfree(sigtarget);
@@ -373,10 +371,10 @@ int writeRPM(Header h, const char *fileName, int type,
        
     /* Append the header and archive */
     ifd = Fopen(sigtarget, "r.fdio");
-    while ((count = Fread(buf, sizeof(buf), 1, ifd)) > 0) {
+    while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), ifd)) > 0) {
        if (count == -1) {
            rpmError(RPMERR_READERROR, _("Unable to read sigtarget: %s"),
-                    strerror(errno));
+                    Fstrerror(ifd));
            Fclose(ifd);
            Fclose(fd);
            unlink(sigtarget);
@@ -384,9 +382,9 @@ int writeRPM(Header h, const char *fileName, int type,
            unlink(fileName);
            return RPMERR_READERROR;
        }
-       if (Fwrite(buf, count, 1, fd) < 0) {
+       if (Fwrite(buf, sizeof(buf[0]), count, fd) < 0) {
            rpmError(RPMERR_NOSPACE, _("Unable to write package: %s"),
-                    strerror(errno));
+                    Fstrerror(fd));
            Fclose(ifd);
            Fclose(fd);
            unlink(sigtarget);
@@ -432,16 +430,17 @@ static int cpio_copy(FD_t fdo, CSA_t *csa)
     char buf[BUFSIZ];
     ssize_t nb;
 
-    while((nb = Fread(buf, sizeof(buf), 1, csa->cpioFdIn)) > 0) {
-       if (Fwrite(buf, nb, 1, fdo) != nb) {
+    while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) {
+       if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) {
            rpmError(RPMERR_CPIO, _("cpio_copy write failed: %s"),
-               strerror(errno));
+                       Fstrerror(fdo));
            return 1;
        }
        csa->cpioArchiveSize += nb;
     }
     if (nb < 0) {
-       rpmError(RPMERR_CPIO, _("cpio_copy read failed: %s"), strerror(errno));
+       rpmError(RPMERR_CPIO, _("cpio_copy read failed: %s"),
+               Fstrerror(csa->cpioFdIn));
        return 1;
     }
     return 0;
index e0063ff..5299deb 100644 (file)
@@ -247,7 +247,7 @@ static int readIcon(Header h, const char *file)
     fd = Fopen(fn, "r.fdio");
     /* XXX Fstrerror */
     /* XXX Ferror check */
-    nb = Fread(icon, statbuf.st_size, 1, fd);
+    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);
index f45ce5f..7d0a3a9 100644 (file)
@@ -62,7 +62,7 @@ static inline off_t saferead(FD_t cfd, /*@out@*/void * vbuf, size_t amount)
     while (amount > 0) {
        size_t nb;
 
-       nb = Fread(buf, amount, 1, cfd);
+       nb = Fread(buf, sizeof(buf[0]), amount, cfd);
        if (nb <= 0)
                return nb;
        rc += nb;
@@ -99,7 +99,7 @@ static inline off_t safewrite(FD_t cfd, const void * vbuf, size_t amount)
     while (amount > 0) {
        size_t nb;
 
-       nb = Fwrite(buf, amount, 1, cfd);
+       nb = Fwrite(buf, sizeof(buf[0]), amount, cfd);
        if (nb <= 0)
                return nb;
        rc += nb;
@@ -315,7 +315,7 @@ static int expandRegular(FD_t cfd, struct cpioHeader * hdr,
                         cpioCallback cb, void * cbData)
 {
     FD_t ofd;
-    char buf[8192];
+    char buf[BUFSIZ];
     int bytesRead;
     int left = hdr->size;
     int rc = 0;
@@ -355,7 +355,7 @@ static int expandRegular(FD_t cfd, struct cpioHeader * hdr,
            break;
        }
 
-       if (Fwrite(buf, bytesRead, 1, ofd) != bytesRead) {
+       if (Fwrite(buf, sizeof(buf[0]), bytesRead, ofd) != bytesRead) {
            rc = CPIOERR_COPY_FAILED;
            break;
        }
@@ -772,9 +772,9 @@ static int writeFile(FD_t cfd, struct stat sb, struct cpioFileMapping * map,
          } else
 #endif
          {
-           amount = Fread(b,
+           amount = Fread(b, sizeof(buf[0]),
                        (sb.st_size > sizeof(buf) ? sizeof(buf) : sb.st_size),
-                       1, datafd);
+                       datafd);
            if (amount <= 0) {
                olderrno = errno;
                Fclose(datafd);
index 334edb0..d10bfc9 100644 (file)
@@ -56,7 +56,7 @@ FD_t fadOpen(const char * path, int flags, int perms)
     if (fadGetFileSize(fd) == 0) {
        newHdr.magic = FA_MAGIC;
        newHdr.firstFree = 0;
-       if (Fwrite(&newHdr, sizeof(newHdr), 1, fd) != sizeof(newHdr)) {
+       if (Fwrite(&newHdr, sizeof(char), sizeof(newHdr), fd) != sizeof(newHdr)) {
            Fclose(fd);
            return NULL;
        }
index a2455a6..da0361a 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -81,6 +81,7 @@ static int checkResponse(urlinfo u, /*@out@*/ int *ecp, /*@out@*/ char ** str)
     URLSANE(u);
     buf = u->buf;
     bufAlloced = u->bufAlloced;
+    *buf = '\0';
 
     errorCode[0] = '\0';
     
@@ -91,6 +92,7 @@ static int checkResponse(urlinfo u, /*@out@*/ int *ecp, /*@out@*/ char ** str)
         * Read next line from server.
         */
        se = buf + bufLength;
+       *se = '\0';
        rc = fdRdline(u->ctrl, se, (bufAlloced - bufLength));
        if (rc < 0) {
            ec = FTPERR_BAD_SERVER_RESPONSE;
@@ -371,13 +373,6 @@ reopen:
        if (rc < 0)
            goto errxit;
 
-#ifdef DYING
-       /* checkResponse() assumes the socket is nonblocking */
-       if (fcntl(fdio->fileno(u->ctrl), F_SETFL, O_NONBLOCK)) {
-           rc = FTPERR_FAILED_CONNECT;
-           goto errxit;
-       }
-#endif
        u->ctrl = fdLink(u->ctrl, "open ctrl (httpOpen)");
     }
 
@@ -478,14 +473,6 @@ int ftpOpen(urlinfo u)
            goto errxit;
     }
 
-#ifdef DYING
-    /* checkResponse() assumes the socket is nonblocking */
-    if (fcntl(fdio->fileno(u->ctrl), F_SETFL, O_NONBLOCK)) {
-       rc = FTPERR_FAILED_CONNECT;
-       goto errxit;
-    }
-#endif
-
     if ((rc = ftpCheckResponse(u, NULL)))
        goto errxit;
 
@@ -507,15 +494,17 @@ errxit:
     return rc;
 }
 
-int ftpFileDone(urlinfo u)
+int ftpFileDone(urlinfo u, FD_t fd)
 {
     int rc = 0;
+    int ftpFileDoneNeeded;
 
     URLSANE(u);
-    assert(u->ftpFileDoneNeeded);
+    ftpFileDoneNeeded = fdGetFtpFileDoneNeeded(fd);
+    assert(ftpFileDoneNeeded);
 
-    if (u->ftpFileDoneNeeded) {
-       u->ftpFileDoneNeeded = 0;
+    if (ftpFileDoneNeeded) {
+       fdSetFtpFileDoneNeeded(fd, 0);
        u->ctrl = fdFree(u->ctrl, "open data (ftpFileDone)");
        u->ctrl = fdFree(u->ctrl, "grab data (ftpFileDone)");
        rc = ftpCheckResponse(u, NULL);
@@ -523,33 +512,28 @@ int ftpFileDone(urlinfo u)
     return rc;
 }
 
-int ftpFileDesc(urlinfo u, const char *cmd)
+int ftpFileDesc(urlinfo u, const char *cmd, FD_t fd)
 {
     struct sockaddr_in dataAddress;
     int cmdlen;
     char * passReply;
     char * chptr;
     int rc;
-    FD_t fd;
+    int ftpFileDoneNeeded;
 
     URLSANE(u);
     if (cmd == NULL)
        return FTPERR_UNKNOWN;  /* XXX W2DO? */
 
     cmdlen = strlen(cmd);
-    fd = u->data;
 
-#ifdef DYING
 /*
  * XXX When ftpFileDesc() is called, there may be a lurking
  * XXX transfer complete message (if ftpFileDone() was not
- * XXX called to clear that message). Clear that message now.
+ * XXX called to clear that message). Detect that condition now.
  */
-    if (u->ftpFileDoneNeeded)
-       rc = ftpFileDone(u);    /* XXX return code ignored */
-#else
-    assert(u->ftpFileDoneNeeded == 0);
-#endif
+    ftpFileDoneNeeded = fdGetFtpFileDoneNeeded(fd);
+    assert(ftpFileDoneNeeded == 0);
 
 /*
  * Get the ftp version of the Content-Length.
@@ -656,7 +640,7 @@ int ftpFileDesc(urlinfo u, const char *cmd)
        goto errxit;
     }
 
-    u->ftpFileDoneNeeded = 1;
+    fdSetFtpFileDoneNeeded(fd, 1);
     u->ctrl = fdLink(u->ctrl, "grab data (ftpFileDesc)");
     u->ctrl = fdLink(u->ctrl, "open data (ftpFileDesc)");
     return 0;
index 2789374..7b05580 100644 (file)
@@ -483,20 +483,20 @@ int headerWrite(FD_t fd, Header h, int magicp)
     p = doHeaderUnload(h, &length);
 
     if (magicp) {
-       nb = Fwrite(header_magic, sizeof(header_magic), 1, fd);
+       nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
        if (nb != sizeof(header_magic)) {
            free(p);
            return 1;
        }
        l = htonl(0);
-       nb = Fwrite(&l, sizeof(l), 1, fd);
+       nb = Fwrite(&l, sizeof(char), sizeof(l), fd);
        if (nb != sizeof(l)) {
            free(p);
            return 1;
        }
     }
     
-    nb = Fwrite(p, length, 1, fd);
+    nb = Fwrite(p, sizeof(char), length, fd);
     if (nb != length) {
        free(p);
        return 1;
@@ -572,20 +572,20 @@ int headerGzWrite(FD_t fd, Header h, int magicp)
     p = doHeaderUnload(h, &length);
 
     if (magicp) {
-       nb = Fwrite(header_magic, sizeof(header_magic), 1, fd);
+       nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
        if (nb != sizeof(header_magic)) {
            free(p);
            return 1;
        }
        l = htonl(0);
-       nb = Fwrite(&l, sizeof(l), 1, fd);
+       nb = Fwrite(&l, sizeof(char), sizeof(l), fd);
        if (nb != sizeof(l)) {
            free(p);
            return 1;
        }
     }
     
-    nb = Fwrite(p, length, 1, fd);
+    nb = Fwrite(p, sizeof(char), length, fd);
     if (nb != length) {
        free(p);
        return 1;
@@ -606,24 +606,24 @@ Header headerGzRead(FD_t fd, int magicp)
     int totalSize;
 
     if (magicp == HEADER_MAGIC_YES) {
-       if (Fread(&magic, sizeof(magic), 1, fd) != sizeof(magic))
+       if (Fread(&magic, sizeof(char), sizeof(magic), fd) != sizeof(magic))
            return NULL;
        if (memcmp(&magic, header_magic, sizeof(magic))) {
            return NULL;
        }
 
-       if (Fread(&reserved, sizeof(reserved), 1, fd) != sizeof(reserved))
+       if (Fread(&reserved, sizeof(char), sizeof(reserved), fd) != sizeof(reserved))
            return NULL;
     }
     
     /* First read the index length (count of index entries) */
-    if (Fread(&il, sizeof(il), 1, fd) != sizeof(il)) 
+    if (Fread(&il, sizeof(char), sizeof(il), fd) != sizeof(il)) 
        return NULL;
 
     il = ntohl(il);
 
     /* Then read the data length (number of bytes) */
-    if (Fread(&dl, sizeof(dl), 1, fd) != sizeof(dl)) 
+    if (Fread(&dl, sizeof(char), sizeof(dl), fd) != sizeof(dl)) 
        return NULL;
 
     dl = ntohl(dl);
@@ -636,7 +636,7 @@ Header headerGzRead(FD_t fd, int magicp)
     *p++ = htonl(dl);
 
     totalSize -= sizeof(int_32) + sizeof(int_32);
-    if (Fread(p, totalSize, 1, fd) != totalSize)
+    if (Fread(p, sizeof(char), totalSize, fd) != totalSize)
        return NULL;
     
     h = headerLoad(block);
index 5b9320f..7212960 100644 (file)
@@ -1349,7 +1349,7 @@ int isCompressed(const char *file, int *compressed)
        rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, strerror(errno));
        return 1;
     }
-    nb = Fread(magic, sizeof(magic), 1, fd);
+    nb = Fread(magic, sizeof(char), sizeof(magic), fd);
     rderrno = errno;
     Fclose(fd);
 
index 39a7a44..03f411a 100644 (file)
@@ -57,7 +57,7 @@ int rpmfileexists(const char * filespec) {
        filespec = strchr(filespec, '/');
        /*@fallthrough@*/
     case URL_IS_UNKNOWN:
-       if (stat(filespec, &buf)) {
+       if (Stat(filespec, &buf)) {
            switch(errno) {
            case ENOENT:
            case EINVAL:
@@ -65,8 +65,8 @@ int rpmfileexists(const char * filespec) {
            }
        }
        break;
-    case URL_IS_DASH:
     case URL_IS_FTP:
+    case URL_IS_DASH:
     case URL_IS_HTTP:
     default:
        return 0;
@@ -356,63 +356,88 @@ char * gidToGname(gid_t gid) {
 }
 
 int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) {
-    const char * fnpath, * fn;
+    const char * tfn;
     FD_t fd;
     int ran;
     struct stat sb, sb2;
 
     if (!prefix) prefix = "";
 
-    fnpath = NULL;
+    tfn = NULL;
 
+    /* XXX should probably use mktemp here */
     srand(time(NULL));
     ran = rand() % 100000;
 
      /* maybe this should use link/stat? */
 
     do {
-       char tfn[32];
-       sprintf(tfn, "rpm-tmp.%d", ran++);
-       if (fnpath)     xfree(fnpath);
-       fnpath = rpmGetPath(prefix, "%{_tmppath}/", tfn, NULL);
-
-       switch (urlIsURL(fnpath)) {
+       char tfnbuf[64];
+       const char * tempfn;
+#ifndef        NOTYET
+       sprintf(tfnbuf, "rpm-tmp.%d", ran++);
+       if (tfn)        xfree(tfn);
+       tfn = tempfn = rpmGetPath("%{_tmppath}/", tfnbuf, NULL);
+#else
+       strcpy(tfnbuf, "rpm-tmp.XXXXXX");
+       if (tfn)        xfree(tfn);
+       tfn = tempfn = rpmGetPath("%{_tmppath}/", mktemp(tfnbuf), NULL);
+#endif
+
+       switch (urlIsURL(tempfn)) {
        case URL_IS_PATH:
-           fn = fnpath + sizeof("file://") - 1;
-           fn = strchr(fn, '/');
-           break;
+           tfn +=  sizeof("file://") - 1;
+           tfn = strchr(tfn, '/');
+           /*@fallthrough@*/
        case URL_IS_UNKNOWN:
-           fn = fnpath;
+           if (prefix && prefix[strlen(prefix) - 1] == '/')
+               while (*tfn == '/') tfn++;
+           tfn = rpmGetPath( (prefix ? prefix : ""), tfn, NULL);
+           xfree(tempfn);
            break;
+       case URL_IS_FTP:
+       case URL_IS_HTTP:
+       case URL_IS_DASH:
        default:
+           xfree(tempfn);
            return 1;
+           /*@notreached@*/
        }
-       fd = fdio->open(fn, O_CREAT | O_RDWR | O_EXCL, 0700);
-    } while (Ferror(fd) && errno == EEXIST);
-
-    if (!stat(fn, &sb) && S_ISLNK(sb.st_mode)) {
-       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fnpath);
-       xfree(fnpath);
+#ifdef DYING
+       fd = fdio->open(tfn, O_CREAT | O_RDWR | O_EXCL, 0700);
+#else
+       fd = Fopen(tfn, "w+x.ufdio");
+fprintf(stderr, "*** mktemp %s fd %p: %s\n", tfnbuf, fd, strerror(errno));
+#endif
+    } while ((fd == NULL || Ferror(fd)) && errno == EEXIST);
+
+    if (!Stat(tfn, &sb) && S_ISLNK(sb.st_mode)) {
+       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), tfn);
+       xfree(tfn);
        return 1;
     }
 
     if (sb.st_nlink != 1) {
-       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fnpath);
-       xfree(fnpath);
+       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), tfn);
+       xfree(tfn);
        return 1;
     }
 
+#ifndef        NOTYET
     fstat(Fileno(fd), &sb2);
+#else
+    Stat(tfn, &sb2);
+#endif
     if (sb2.st_ino != sb.st_ino || sb2.st_dev != sb.st_dev) {
-       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fnpath);
-       xfree(fnpath);
+       rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), tfn);
+       xfree(tfn);
        return 1;
     }
 
     if (fnptr)
-       *fnptr = fnpath;
+       *fnptr = tfn;
     else
-       xfree(fnpath);
+       xfree(tfn);
     *fdptr = fd;
 
     return 0;
index 92f41fb..42e6bbd 100644 (file)
@@ -45,7 +45,7 @@ char * oldhdrReadFromStream(FD_t fd, struct oldrpmHeader * header) {
     unsigned int groupLength;
 
     if (timedRead(fd, (char *)&lit, sizeof(lit)) != sizeof(lit)) {
-       return strerror(errno);
+       return Fstrerror(fd);
     }
 
     bytesRead = sizeof(lit);
@@ -90,7 +90,7 @@ char * oldhdrReadFromStream(FD_t fd, struct oldrpmHeader * header) {
 
        if (timedRead(fd, header->group, groupLength) != groupLength) {
            oldhdrFree(header);
-           return strerror(errno);
+           return Fstrerror(fd);
        }
        header->group[groupLength] = '\0';
        bytesRead += groupLength;
@@ -109,7 +109,7 @@ char * oldhdrReadFromStream(FD_t fd, struct oldrpmHeader * header) {
        if (timedRead(fd, header->icon, header->iconLength) != 
                        header->iconLength) {
            oldhdrFree(header);
-           return strerror(errno);
+           return Fstrerror(fd);
        }
        bytesRead += header->iconLength;
     } else {
@@ -119,21 +119,21 @@ char * oldhdrReadFromStream(FD_t fd, struct oldrpmHeader * header) {
     while (bytesRead < specOffset) {
        if (timedRead(fd, &ch, 1) != 1) {
            oldhdrFree(header);
-           return strerror(errno);
+           return Fstrerror(fd);
        }
        bytesRead++;
     }
 
     if (timedRead(fd, header->spec, header->specLength) != header->specLength) {
        oldhdrFree(header);
-       return strerror(errno);
+       return Fstrerror(fd);
     }
     bytesRead += header->specLength;
 
     while (bytesRead < archiveOffset) {
        if (timedRead(fd, &ch, 1) != 1) {
            oldhdrFree(header);
-           return strerror(errno);
+           return Fstrerror(fd);
        }
        bytesRead++;
     }
index 79d42cc..17cad7b 100644 (file)
@@ -458,13 +458,19 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
     case RPMQV_RPM:
     { const char *myargv[2], **argv = myargv;;
 
+      /* XXX prepare for remglob */
       argv[0] = arg;
       argv[1] = NULL;
       while ((arg = *argv++) != NULL) {
        FD_t fd = Fopen(arg, "r.ufdio");
        if (Ferror(fd)) {
            /* XXX Fstrerror */
-           fprintf(stderr, _("open of %s failed: %s\n"), arg,urlStrerror(arg));
+           fprintf(stderr, _("open of %s failed: %s\n"), arg,
+#ifndef        NOTYET
+                       urlStrerror(arg));
+#else
+                       Fstrerror(fd));
+#endif
            Fclose(fd);
            retcode = 1;
            break;
index c4e39c9..36515b3 100644 (file)
@@ -26,12 +26,15 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags, int rc)
 
     /* open a file and set *fdp */
     if (*fdp == NULL && fnp && *fnp) {
+#ifdef DYING
        mode_t mode = (flags & O_CREAT) ? 0644 : 0;
        fd = fdio->open(*fnp, flags, mode);
+#else
+       fd = Fopen(*fnp, ((flags & O_RDONLY) ? "r.fdio" : "w.fdio"));
+#endif
        if (Ferror(fd)) {
-           /* XXX Fstrerror */
            fprintf(stderr, _("%s: open failed: %s\n"), *fnp,
-               strerror(errno));
+               Fstrerror(fd));
            return 1;
        }
        *fdp = fd;
@@ -62,7 +65,7 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags, int rc)
 static int copyFile(FD_t *sfdp, const char **sfnp,
        FD_t *tfdp, const char **tfnp)
 {
-    unsigned char buffer[8192];
+    unsigned char buffer[BUFSIZ];
     ssize_t count;
     int rc = 1;
 
@@ -71,15 +74,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 = Fread(buffer, sizeof(buffer), 1, *sfdp)) > 0) {
-       if (Fwrite(buffer, count, 1, *tfdp) < 0) {
+    while ((count = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), *sfdp)) > 0) {
+       if (Fwrite(buffer, sizeof(buffer[0]), count, *tfdp) < 0) {
            fprintf(stderr, _("%s: Fwrite failed: %s\n"), *tfnp,
-               strerror(errno));
+               Fstrerror(*tfdp));
            goto exit;
        }
     }
     if (count < 0) {
-       fprintf(stderr, _("%s: Fread failed: %s\n"), *sfnp, strerror(errno));
+       fprintf(stderr, _("%s: Fread failed: %s\n"), *sfnp, Fstrerror(*sfdp));
        goto exit;
     }
 
@@ -167,12 +170,13 @@ int rpmReSign(int add, char *passPhrase, const char **argv)
        lead.signature_type = RPMSIG_HEADERSIG;
        if (writeLead(ofd, &lead)) {
            fprintf(stderr, _("%s: writeLead failed: %s\n"), trpm,
-               strerror(errno));
+               Fstrerror(ofd));
            goto exit;
        }
 
        if (rpmWriteSignature(ofd, sig)) {
-           fprintf(stderr, _("%s: rpmWriteSignature failed\n"), trpm);
+           fprintf(stderr, _("%s: rpmWriteSignature failed: %s\n"), trpm,
+               Fstrerror(ofd));
            goto exit;
        }
 
index 090a2e7..08436b7 100644 (file)
@@ -152,8 +152,8 @@ int openDatabase(const char * prefix, const char * dbpath, rpmdb *rpmdbp, int mo
     if (!justcheck || !rpmfileexists(filename)) {
        db->pkgs = fadOpen(filename, mode, perms);
        if (Ferror(db->pkgs)) {
-           /* XXX Fstrerror */
-           rpmError(RPMERR_DBOPEN, _("failed to open %s\n"), filename);
+           rpmError(RPMERR_DBOPEN, _("failed to open %s: %s\n"), filename,
+               Fstrerror(db->pkgs));
            return 1;
        }
 
index 567847e..4dba461 100644 (file)
@@ -4,16 +4,6 @@
 #include <rpmmacro.h>
 #include <rpmurl.h>
 
-#ifdef DYING
-#include "build/rpmbuild.h"
-
-static void printHash(const unsigned long amount, const unsigned long total);
-static void * showProgress(const Header h, const rpmCallbackType what, 
-                          const unsigned long amount, 
-                          const unsigned long total,
-                          const void * pkgKey, void * data);
-#endif
-
 static int hashesPrinted = 0;
 
 static void printHash(const unsigned long amount, const unsigned long total) {
@@ -152,10 +142,26 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
                fprintf(stdout, _("Retrieving %s\n"), *filename);
 
            {   char tfnbuf[64];
+               const char * tempfn;
                strcpy(tfnbuf, "rpm-xfer.XXXXXX");
                /* XXX watchout for rootdir = NULL */
-               tfn = rpmGetPath( (rootdir ? rootdir : ""),
-                   "%{_tmppath}/", mktemp(tfnbuf), NULL);
+               tfn = tempfn = rpmGetPath("%{_tmppath}/", mktemp(tfnbuf), NULL);
+               switch(urlIsURL(tempfn)) {
+               case URL_IS_FTP:
+               case URL_IS_HTTP:
+               case URL_IS_DASH:
+                   break;
+               case URL_IS_PATH:
+                   tfn += sizeof("file://") - 1;
+                   tfn = strchr(tfn, '/');
+                   /*@fallthrough@*/
+               case URL_IS_UNKNOWN:
+                   if (rootdir && rootdir[strlen(rootdir) - 1] == '/')
+                       while (*tfn == '/') tfn++;
+                   tfn = rpmGetPath( (rootdir ? rootdir : ""), tfn, NULL);
+                   xfree(tempfn);
+                   break;
+               }
            }
 
            rpmMessage(RPMMESS_DEBUG, _(" ... as %s\n"), tfn);
@@ -188,8 +194,8 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
     for (filename = packages; *filename; filename++) {
        fd = Fopen(*filename, "r.ufdio");
        if (Ferror(fd)) {
-           /* XXX Fstrerror */
-           rpmMessage(RPMMESS_ERROR, _("cannot open file %s\n"), *filename);
+           rpmMessage(RPMMESS_ERROR, _("cannot open file %s: %s\n"), *filename,
+               Fstrerror(fd));
            numFailed++;
            packages[i] = NULL;
            continue;
@@ -328,11 +334,10 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
 
     if (numSourcePackages && !stopInstall) {
        for (i = 0; i < numSourcePackages; i++) {
-           fd = Fopen(sourcePackages[i], "r.fdio");
+           fd = Fopen(sourcePackages[i], "r.ufdio");
            if (Ferror(fd)) {
-               /* XXX Fstrerror */
-               rpmMessage(RPMMESS_ERROR, _("cannot open file %s\n"), 
-                          sourcePackages[i]);
+               rpmMessage(RPMMESS_ERROR, _("cannot open file %s: %s\n"), 
+                          sourcePackages[i], Fstrerror(fd));
                continue;
            }
 
@@ -458,8 +463,7 @@ int rpmInstallSource(const char * rootdir, const char * arg, const char ** specF
 
     fd = Fopen(arg, "r.ufdio");
     if (Ferror(fd)) {
-       /* XXX Fstrerror */
-       rpmMessage(RPMMESS_ERROR, _("cannot open %s\n"), arg);
+       rpmMessage(RPMMESS_ERROR, _("cannot open %s: %s\n"), arg, Fstrerror(fd));
        Fclose(fd);
        return 1;
     }
index 5f1b3c3..de836be 100644 (file)
@@ -84,9 +84,13 @@ void fdSetIoCookie(FD_t fd, FDIO_t iop);
 
 int fdGetRdTimeoutSecs(FD_t fd);
 
+int fdGetFtpFileDoneNeeded(FD_t fd);
+void fdSetFtpFileDoneNeeded(FD_t fd, int ftpFileDoneNeeded);
+
 long int fdGetCpioPos(FD_t fd);
-extern /*@null@*/ FD_t fdDup(int fdno);
 void fdSetCpioPos(FD_t fd, long int cpioPos);
+
+extern /*@null@*/ FD_t fdDup(int fdno);
 #ifdef UNUSED
 extern /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
 #endif
@@ -117,7 +121,7 @@ extern /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
 /*@observer@*/ const char * urlStrerror(const char * url);
 
 int httpGetFile( /*@killref@*/ FD_t sfd, FD_t tfd);
-int ftpGetFile( /*@killref@*/ FD_t sfd, FD_t tfd);
+int ftpGetFile( /*@killref@*/ FD_t sfd, FD_t tfd, const char * ftpcmd);
 const char *const ftpStrerror(int errorNumber);
 
 #if 0
index e1a9706..9ec3f6d 100644 (file)
@@ -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 (Fwrite(&l, sizeof(l), 1, fd) < 0) {
+    if (Fwrite(&l, sizeof(char), sizeof(l), fd) < 0) {
        return 1;
     }
 
@@ -45,7 +45,7 @@ int writeLead(FD_t fd, struct rpmlead *lead)
 int readLead(FD_t fd, struct rpmlead *lead)
 {
     if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
-       rpmError(RPMERR_READERROR, _("read failed: %s (%d)"), strerror(errno), 
+       rpmError(RPMERR_READERROR, _("read failed: %s (%d)"), Fstrerror(fd), 
              errno);
        return 1;
     }
index 1c485a5..d8d4fbb 100644 (file)
@@ -553,9 +553,8 @@ int rpmReadRC(const char * rcfiles)
            /* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
            if (rcfiles == defrcfiles && myrcfiles != r)
                continue;
-           /* XXX Fstrerror */
            rpmError(RPMERR_RPMRC, _("Unable to open %s for reading: %s."),
-                fn, strerror(errno));
+                fn, Fstrerror(fd));
            rc = 1;
            break;
        } else {
@@ -596,10 +595,10 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
     nb = (sb.st_size > 0 ?  sb.st_size : 8*BUFSIZ);
     next = alloca(nb + 2);
     next[0] = '\0';
-    rc = Fread(next, nb, 1, fd);
+    rc = Fread(next, sizeof(*next), nb, fd);
     if (Ferror(fd) || (sb.st_size > 0 && rc != nb)) {  /* XXX Feof(fd) */
        rpmError(RPMERR_RPMRC, _("Failed to read %s: %s."), filename,
-                strerror(errno));
+                Fstrerror(fd));
        rc = 1;
     } else
        rc = 0;
@@ -674,9 +673,8 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * filename)
 
                fdinc = Fopen(fn, "r.ufdio");
                if (fdinc == NULL || Ferror(fdinc)) {
-                   /* XXX Fstrerror */
-                   rpmError(RPMERR_RPMRC, _("cannot open %s at %s:%d"),
-                       fn, filename, linenum);
+                   rpmError(RPMERR_RPMRC, _("cannot open %s at %s:%d: %s"),
+                       fn, filename, linenum, Fstrerror(fdinc));
                    rc = 1;
                } else {
                    rc = doReadRC(fdinc, fn);
@@ -853,7 +851,7 @@ static void defaultMachine(const char ** arch, const char ** os) {
            if (!Ferror(fd)) {
                chptr = (char *) xcalloc(1, 256);
                if (chptr != NULL) {
-                   int irelid = Fread(chptr, 256, 1, fd);
+                   int irelid = Fread(chptr, sizeof(*chptr), 256, fd);
                    Fclose(fd);
                    /* example: "112393 RELEASE 020200 Version 01 OS" */
                    if (irelid > 0) {
index ff09868..c021205 100644 (file)
@@ -51,7 +51,6 @@ typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo {
     FD_t data;                 /* per-xfer data channel */
     int bufAlloced;            /* sizeof I/O buffer */
     char *buf;                 /* I/O buffer */
-    int ftpFileDoneNeeded;
     int openError;             /* Type of open failure */
     int httpVersion;
     int httpHasRange;
@@ -69,8 +68,8 @@ int   ftpCommand(urlinfo u, ...);
 
 int    httpOpen(urlinfo u, const char * httpcmd);
 int    ftpOpen(urlinfo u);
-int    ftpFileDone(urlinfo u);
-int    ftpFileDesc(urlinfo u, const char * cmd);
+int    ftpFileDone(urlinfo u, FD_t fd);
+int    ftpFileDesc(urlinfo u, const char * cmd, FD_t fd);
 
 urlinfo        urlLink(urlinfo u, const char * msg);
 urlinfo        XurlLink(urlinfo u, const char * msg, const char * file, unsigned line);
index ca6b2e8..8005e40 100644 (file)
@@ -203,7 +203,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 (Fwrite(buf, pad, 1, fd) != pad)
+       if (Fwrite(buf, sizeof(buf[0]), pad, fd) != pad)
            rc = 1;
     }
     return rc;
@@ -480,7 +480,7 @@ static int verifyPGPSignature(const char *datafile, void *sig,
     int pid, status, outpipe[2];
     FD_t sfd;
     char *sigfile;
-    unsigned char buf[8192];
+    unsigned char buf[BUFSIZ];
     FILE *file;
     int res = RPMSIG_OK;
     const char *path;
@@ -507,7 +507,7 @@ static int verifyPGPSignature(const char *datafile, void *sig,
     xfree(tmppath);
   }
     sfd = Fopen(sigfile, "w.fdio");
-    (void)Fwrite(sig, count, 1, sfd);
+    (void)Fwrite(sig, sizeof(char), count, sfd);
     Fclose(sfd);
 
     /* Now run PGP */
@@ -602,7 +602,7 @@ static int verifyGPGSignature(const char *datafile, void *sig,
     xfree(tmppath);
   }
     sfd = Fopen(sigfile, "w.fdio");
-    (void)Fwrite(sig, count, 1, sfd);
+    (void)Fwrite(sig, sizeof(char), count, sfd);
     Fclose(sfd);
 
     /* Now run GPG */
index ab2363a..8562513 100644 (file)
@@ -50,13 +50,13 @@ static int doFIO(const char *ofn, const char *rfmode, const char *wfmode)
 
     if ((fd = Fopen(ofn, wfmode)) == NULL)
        warn("Fopen: write %s (%s) %s\n", wfmode, rfmode, ofn);
-    else if ((rc = Fwrite(ofn, 1, strlen(ofn), fd)) != strlen(ofn))
+    else if ((rc = Fwrite(ofn, sizeof(ofn[0]), strlen(ofn), fd)) != strlen(ofn))
        warn("Fwrite: write %s (%s) %s\n", wfmode, rfmode, ofn);
     else if ((rc = Fclose(fd)) != 0)
        warn("Fclose: write %s (%s) %s\n", wfmode, rfmode, ofn);
     else if ((fd = Fopen(ofn, rfmode)) == NULL)
        warn("Fopen: read %s (%s) %s\n", rfmode, wfmode, ofn);
-    else if ((rc = Fread(buf, 1, sizeof(buf), fd)) != strlen(ofn))
+    else if ((rc = Fread(buf, sizeof(buf[0]), sizeof(buf), fd)) != strlen(ofn))
        warn("Fread: read %s (%s) %s\n", rfmode, wfmode, ofn);
     else if ((rc = Fclose(fd)) != 0)
        warn("Fclose: read %s (%s) %s\n", rfmode, wfmode, ofn);
index c0ca95f..18e8af1 100644 (file)
@@ -289,9 +289,9 @@ 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)Fwrite("set -x\n", 7, 1, fd);
+           (void)Fwrite("set -x\n", sizeof(char), 7, fd);
 
-       (void)Fwrite(script, strlen(script), 1, fd);
+       (void)Fwrite(script, sizeof(script[0]), strlen(script), fd);
        Fclose(fd);
 
        argv[argc++] = fn + strlen(root);
index 1e75ed5..d3f0d29 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -49,7 +49,6 @@ urlinfo XurlNew(const char *msg, const char *file, unsigned line)
     u->data = NULL;
     u->bufAlloced = 0;
     u->buf = NULL;
-    u->ftpFileDoneNeeded = 0;
     u->httpHasRange = 1;
     u->httpContentLength = 0;
     u->httpPersist = u->httpVersion = 0;
@@ -69,16 +68,16 @@ DBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, li
            fdio->close(u->ctrl);
        u->ctrl = fdio->deref(u->ctrl, "persist ctrl (urlFree)", file, line);
        if (u->ctrl)
-           fprintf(stderr, "warning: ctrl nrefs != 0 (%s %s)\n",
-                       u->host, u->service);
+           fprintf(stderr, _("warning: u %p ctrl nrefs != 0 (%s %s)\n"),
+                       u, u->host, u->service);
     }
     if (u->data) {
        if (fdio->fileno(u->data) >= 0)
            fdio->close(u->data);
        u->data = fdio->deref(u->data, "persist data (urlFree)", file, line);
        if (u->data)
-           fprintf(stderr, "warning: data nrefs != 0 (%s %s)\n",
-                       u->host, u->service);
+           fprintf(stderr, _("warning: data nrefs != 0 (%s %s)\n"),
+                       u, u->host, u->service);
     }
     if (u->buf) {
        free(u->buf);
@@ -105,8 +104,9 @@ void urlFreeCache(void)
        if (uCache[i] == NULL) continue;
        uCache[i] = urlFree(uCache[i], "uCache");
        if (uCache[i])
-           fprintf(stderr, "warning: nrefs(%d) != 1 (%s %s)\n", uCache[i]->nrefs,
-                       uCache[i]->host, uCache[i]->service);
+           fprintf(stderr, _("warning: uCache[%d] %p nrefs(%d) != 1 (%s %s)\n"),
+               i, uCache[i], uCache[i]->nrefs,
+               uCache[i]->host, uCache[i]->service);
     }
     if (uCache)
        free(uCache);
@@ -400,8 +400,7 @@ int urlGetFile(const char * url, const char * dest) {
 
     sfd = Fopen(url, "r.ufdio");
     if (sfd == NULL || Ferror(sfd)) {
-       /* XXX Fstrerror */
-       rpmMessage(RPMMESS_DEBUG, _("failed to open %s\n"), url);
+       rpmMessage(RPMMESS_DEBUG, _("failed to open %s: %s\n"), url, Fstrerror(sfd));
        Fclose(sfd);
        return FTPERR_UNKNOWN;
     }
@@ -419,33 +418,41 @@ int urlGetFile(const char * url, const char * dest) {
        sfu = NULL;
     }
 
-    tfd = Fopen(dest, "w.fdio");
+    tfd = Fopen(dest, "w.ufdio");
+if (_url_debug)
+fprintf(stderr, "*** urlGetFile sfd %p %s tfd %p %s\n", sfd, url, tfd, dest);
     if (Ferror(tfd)) {
        /* XXX Fstrerror */
-       rpmMessage(RPMMESS_DEBUG, _("failed to create %s\n"), dest);
-       Fclose(tfd);
-       Fclose(sfd);
+       rpmMessage(RPMMESS_DEBUG, _("failed to create %s: %s\n"), dest, Fstrerror(tfd));
+       if (tfd)
+           Fclose(tfd);
+       if (sfd)
+           Fclose(sfd);
        return FTPERR_UNKNOWN;
     }
 
     switch (urlIsURL(url)) {
     case URL_IS_FTP:
-       if ((rc = ftpGetFile(sfd, tfd))) {
+#ifdef DYING
+       if ((rc = ftpGetFile(sfd, tfd, "RETR"))) {
            unlink(dest);
+           /* XXX FIXME: sfd possibly closed by copyData */
            /*@-usereleased@*/ Fclose(sfd) /*@=usereleased@*/ ;
        }
        /* XXX Fclose(sfd) done by copyData */
        break;
+#endif
     case URL_IS_HTTP:
     case URL_IS_PATH:
     case URL_IS_DASH:
+    case URL_IS_UNKNOWN:
        if ((rc = httpGetFile(sfd, tfd))) {
            unlink(dest);
+           /* XXX FIXME: sfd possibly closed by copyData */
            /*@-usereleased@*/ Fclose(sfd) /*@=usereleased@*/ ;
        }
        /* XXX Fclose(sfd) done by copyData */
        break;
-    case URL_IS_UNKNOWN:
     default:
        rc = FTPERR_UNKNOWN;
        break;
index 495736c..daf156a 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-11-09 15:28-0500\n"
+"POT-Creation-Date: 1999-11-10 16:44-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -14,7 +14,7 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: ENCODING\n"
 
-#: build.c:25 lib/rpminstall.c:223 lib/rpminstall.c:384
+#: build.c:25 lib/rpminstall.c:229 lib/rpminstall.c:389
 #, c-format
 msgid "cannot open %s/packages.rpm\n"
 msgstr ""
@@ -26,7 +26,7 @@ msgstr ""
 #. XXX Fstrerror
 #: build.c:65
 #, c-format
-msgid "Unable to open spec file: %s\n"
+msgid "Unable to open spec file %s: %s\n"
 msgstr ""
 
 #: build.c:121 build.c:134
@@ -1225,7 +1225,7 @@ msgstr ""
 msgid "error reading header from package\n"
 msgstr ""
 
-#: build/build.c:84 build/pack.c:268
+#: build/build.c:84 build/pack.c:267
 msgid "Unable to open temp file"
 msgstr ""
 
@@ -1407,7 +1407,7 @@ msgstr ""
 msgid "Could not open %%files file: %s"
 msgstr ""
 
-#: build/files.c:1190 build/pack.c:467
+#: build/files.c:1190 build/pack.c:466
 #, c-format
 msgid "line: %s"
 msgstr ""
@@ -1417,37 +1417,38 @@ msgstr ""
 msgid "Bad owner/group: %s"
 msgstr ""
 
-#: build/files.c:1585
+#. XXX this error message is probably not seen.
+#: build/files.c:1586
 #, c-format
 msgid "Couldn't exec %s: %s"
 msgstr ""
 
-#: build/files.c:1590
+#: build/files.c:1591
 #, c-format
 msgid "Couldn't fork %s: %s"
 msgstr ""
 
-#: build/files.c:1672
+#: build/files.c:1673
 #, c-format
 msgid "%s failed"
 msgstr ""
 
-#: build/files.c:1676
+#: build/files.c:1677
 #, c-format
 msgid "failed to write all data to %s"
 msgstr ""
 
-#: build/files.c:1765
+#: build/files.c:1766
 #, c-format
 msgid "Finding  %s: (using %s)...\n"
 msgstr ""
 
-#: build/files.c:1793 build/files.c:1802
+#: build/files.c:1794 build/files.c:1803
 #, c-format
 msgid "Failed to find %s:"
 msgstr ""
 
-#: build/files.c:1908
+#: build/files.c:1909
 #, c-format
 msgid "Processing files: %s-%s-%s\n"
 msgstr ""
@@ -1475,98 +1476,96 @@ msgstr ""
 msgid "cannot create %s: %s\n"
 msgstr ""
 
-#. XXX Fstrerror
-#: build/pack.c:185
+#: build/pack.c:184
 #, c-format
 msgid "readRPM: open %s: %s\n"
 msgstr ""
 
-#: build/pack.c:195
+#: build/pack.c:194
 #, c-format
 msgid "readRPM: read %s: %s\n"
 msgstr ""
 
-#: build/pack.c:216
+#: build/pack.c:215
 #, c-format
 msgid "readRPM: %s is not an RPM package\n"
 msgstr ""
 
-#: build/pack.c:222
+#: build/pack.c:221
 #, c-format
 msgid "readRPM: reading header from %s\n"
 msgstr ""
 
-#: build/pack.c:279
+#: build/pack.c:278
 msgid "Bad CSA data"
 msgstr ""
 
-#. XXX Fstrerror
-#: build/pack.c:314
+#: build/pack.c:312
 #, c-format
-msgid "Could not open %s\n"
+msgid "Could not open %s: %s\n"
 msgstr ""
 
-#: build/pack.c:346 build/pack.c:388
+#: build/pack.c:344 build/pack.c:386
 #, c-format
 msgid "Unable to write package: %s"
 msgstr ""
 
-#: build/pack.c:361
+#: build/pack.c:359
 #, c-format
 msgid "Generating signature: %d\n"
 msgstr ""
 
-#: build/pack.c:378
+#: build/pack.c:376
 #, c-format
 msgid "Unable to read sigtarget: %s"
 msgstr ""
 
-#: build/pack.c:403
+#: build/pack.c:401
 #, c-format
 msgid "Wrote: %s\n"
 msgstr ""
 
-#: build/pack.c:418
+#: build/pack.c:416
 #, c-format
 msgid "create archive failed on file %s: %s"
 msgstr ""
 
-#: build/pack.c:437
+#: build/pack.c:435
 #, c-format
 msgid "cpio_copy write failed: %s"
 msgstr ""
 
-#: build/pack.c:444
+#: build/pack.c:442
 #, c-format
 msgid "cpio_copy read failed: %s"
 msgstr ""
 
-#: build/pack.c:523
+#: build/pack.c:522
 #, c-format
 msgid "Could not open PreIn file: %s"
 msgstr ""
 
-#: build/pack.c:530
+#: build/pack.c:529
 #, c-format
 msgid "Could not open PreUn file: %s"
 msgstr ""
 
-#: build/pack.c:537
+#: build/pack.c:536
 #, c-format
 msgid "Could not open PostIn file: %s"
 msgstr ""
 
-#: build/pack.c:544
+#: build/pack.c:543
 #, c-format
 msgid "Could not open PostUn file: %s"
 msgstr ""
 
-#: build/pack.c:552
+#: build/pack.c:551
 #, c-format
 msgid "Could not open VerifyScript file: %s"
 msgstr ""
 
-#: build/pack.c:568
+#: build/pack.c:567
 #, c-format
 msgid "Could not open Trigger script file: %s"
 msgstr ""
@@ -2389,7 +2388,7 @@ msgstr ""
 msgid "internal error (rpm bug?): "
 msgstr ""
 
-#: lib/misc.c:394 lib/misc.c:400 lib/misc.c:407
+#: lib/misc.c:415 lib/misc.c:421 lib/misc.c:432
 #, c-format
 msgid "error creating temporary file %s"
 msgstr ""
@@ -2530,145 +2529,145 @@ msgstr ""
 msgid "open of %s failed: %s\n"
 msgstr ""
 
-#: lib/query.c:480
+#: lib/query.c:485
 msgid "old format source packages cannot be queried\n"
 msgstr ""
 
-#: lib/query.c:489 lib/rpminstall.c:204
+#: lib/query.c:494 lib/rpminstall.c:210
 #, c-format
 msgid "%s does not appear to be a RPM package\n"
 msgstr ""
 
-#: lib/query.c:492
+#: lib/query.c:497
 #, c-format
 msgid "query of %s failed\n"
 msgstr ""
 
-#: lib/query.c:520
+#: lib/query.c:525
 #, c-format
 msgid "query of specfile %s failed, can't parse\n"
 msgstr ""
 
-#: lib/query.c:545
+#: lib/query.c:550
 msgid "could not read database record!\n"
 msgstr ""
 
-#: lib/query.c:556
+#: lib/query.c:561
 #, c-format
 msgid "group %s does not contain any packages\n"
 msgstr ""
 
-#: lib/query.c:566
+#: lib/query.c:571
 #, c-format
 msgid "no package provides %s\n"
 msgstr ""
 
-#: lib/query.c:576
+#: lib/query.c:581
 #, c-format
 msgid "no package triggers %s\n"
 msgstr ""
 
-#: lib/query.c:586
+#: lib/query.c:591
 #, c-format
 msgid "no package requires %s\n"
 msgstr ""
 
-#: lib/query.c:601
+#: lib/query.c:606
 #, c-format
 msgid "file %s: %s\n"
 msgstr ""
 
-#: lib/query.c:604
+#: lib/query.c:609
 #, c-format
 msgid "file %s is not owned by any package\n"
 msgstr ""
 
-#: lib/query.c:617
+#: lib/query.c:622
 #, c-format
 msgid "invalid package number: %s\n"
 msgstr ""
 
-#: lib/query.c:620
+#: lib/query.c:625
 #, c-format
 msgid "package record number: %d\n"
 msgstr ""
 
-#: lib/query.c:623
+#: lib/query.c:628
 #, c-format
 msgid "record %d could not be read\n"
 msgstr ""
 
-#: lib/query.c:635 lib/rpminstall.c:395
+#: lib/query.c:640 lib/rpminstall.c:400
 #, c-format
 msgid "package %s is not installed\n"
 msgstr ""
 
-#: lib/query.c:638
+#: lib/query.c:643
 #, c-format
 msgid "error looking for package %s\n"
 msgstr ""
 
-#: lib/query.c:660
+#: lib/query.c:665
 msgid "rpmQuery: rpmdbOpen() failed\n"
 msgstr ""
 
-#: lib/query.c:719
+#: lib/query.c:724
 msgid "query package owning file"
 msgstr ""
 
-#: lib/query.c:721
+#: lib/query.c:726
 msgid "query packages in group"
 msgstr ""
 
-#: lib/query.c:723
+#: lib/query.c:728
 msgid "query a package file"
 msgstr ""
 
-#: lib/query.c:727
+#: lib/query.c:732
 msgid "query a spec file"
 msgstr ""
 
-#: lib/query.c:729
+#: lib/query.c:734
 msgid "query the pacakges triggered by the package"
 msgstr ""
 
-#: lib/query.c:731
+#: lib/query.c:736
 msgid "query the packages which require a capability"
 msgstr ""
 
-#: lib/query.c:733
+#: lib/query.c:738
 msgid "query the packages which provide a capability"
 msgstr ""
 
-#: lib/query.c:772
+#: lib/query.c:777
 msgid "list all configuration files"
 msgstr ""
 
-#: lib/query.c:774
+#: lib/query.c:779
 msgid "list all documentation files"
 msgstr ""
 
-#: lib/query.c:776
+#: lib/query.c:781
 msgid "dump basic file information"
 msgstr ""
 
-#: lib/query.c:778
+#: lib/query.c:783
 msgid "list files in package"
 msgstr ""
 
-#: lib/query.c:782
+#: lib/query.c:787
 msgid "use the following query format"
 msgstr ""
 
-#: lib/query.c:784
+#: lib/query.c:789
 msgid "substitute i18n sections from the following catalogue"
 msgstr ""
 
-#: lib/query.c:787
+#: lib/query.c:792
 msgid "display the states of the listed files"
 msgstr ""
 
-#: lib/query.c:789
+#: lib/query.c:794
 msgid "display a verbose file listing"
 msgstr ""
 
@@ -2732,87 +2731,86 @@ msgstr ""
 msgid "failed to remove directory %s: %s\n"
 msgstr ""
 
-#. XXX Fstrerror
-#: lib/rpmchecksig.c:33
+#: lib/rpmchecksig.c:36
 #, c-format
 msgid "%s: open failed: %s\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:44
+#: lib/rpmchecksig.c:47
 msgid "makeTempFile failed\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:76
+#: lib/rpmchecksig.c:79
 #, c-format
 msgid "%s: Fwrite failed: %s\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:82
+#: lib/rpmchecksig.c:85
 #, c-format
 msgid "%s: Fread failed: %s\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:115 lib/rpmchecksig.c:244
+#: lib/rpmchecksig.c:118 lib/rpmchecksig.c:248
 #, c-format
 msgid "%s: readLead failed\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:120
+#: lib/rpmchecksig.c:123
 #, c-format
 msgid "%s: Can't sign v1.0 RPM\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:124
+#: lib/rpmchecksig.c:127
 #, c-format
 msgid "%s: Can't re-sign v2.0 RPM\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:132 lib/rpmchecksig.c:258
+#: lib/rpmchecksig.c:135 lib/rpmchecksig.c:262
 #, c-format
 msgid "%s: rpmReadSignature failed\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:136 lib/rpmchecksig.c:263
+#: lib/rpmchecksig.c:139 lib/rpmchecksig.c:267
 #, c-format
 msgid "%s: No signature available\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:169
+#: lib/rpmchecksig.c:172
 #, c-format
 msgid "%s: writeLead failed: %s\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:175
+#: lib/rpmchecksig.c:178
 #, c-format
-msgid "%s: rpmWriteSignature failed\n"
+msgid "%s: rpmWriteSignature failed: %s\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:250
+#: lib/rpmchecksig.c:254
 #, c-format
 msgid "%s: No signature available (v1.0 RPM)\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:413
+#: lib/rpmchecksig.c:417
 msgid "NOT OK"
 msgstr ""
 
-#: lib/rpmchecksig.c:414 lib/rpmchecksig.c:428
+#: lib/rpmchecksig.c:418 lib/rpmchecksig.c:432
 msgid " (MISSING KEYS:"
 msgstr ""
 
-#: lib/rpmchecksig.c:416 lib/rpmchecksig.c:430
+#: lib/rpmchecksig.c:420 lib/rpmchecksig.c:434
 msgid ") "
 msgstr ""
 
-#: lib/rpmchecksig.c:417 lib/rpmchecksig.c:431
+#: lib/rpmchecksig.c:421 lib/rpmchecksig.c:435
 msgid " (UNTRUSTED KEYS:"
 msgstr ""
 
-#: lib/rpmchecksig.c:419 lib/rpmchecksig.c:433
+#: lib/rpmchecksig.c:423 lib/rpmchecksig.c:437
 msgid ")"
 msgstr ""
 
-#: lib/rpmchecksig.c:427
+#: lib/rpmchecksig.c:431
 msgid "OK"
 msgstr ""
 
@@ -2821,10 +2819,9 @@ msgstr ""
 msgid "opening database mode 0x%x in %s\n"
 msgstr ""
 
-#. XXX Fstrerror
-#: lib/rpmdb.c:156 lib/url.c:404
+#: lib/rpmdb.c:155 lib/url.c:403
 #, c-format
-msgid "failed to open %s\n"
+msgid "failed to open %s: %s\n"
 msgstr ""
 
 #: lib/rpmdb.c:169 lib/rpmdb.c:177
@@ -2919,156 +2916,154 @@ msgstr ""
 msgid "header changed size!"
 msgstr ""
 
-#: lib/rpminstall.c:128
+#: lib/rpminstall.c:118
 msgid "counting packages to install\n"
 msgstr ""
 
-#: lib/rpminstall.c:132
+#: lib/rpminstall.c:122
 #, c-format
 msgid "found %d packages\n"
 msgstr ""
 
-#: lib/rpminstall.c:141
+#: lib/rpminstall.c:131
 msgid "looking for packages to download\n"
 msgstr ""
 
-#: lib/rpminstall.c:152
+#: lib/rpminstall.c:142
 #, c-format
 msgid "Retrieving %s\n"
 msgstr ""
 
-#: lib/rpminstall.c:161
+#: lib/rpminstall.c:167
 #, c-format
 msgid " ... as %s\n"
 msgstr ""
 
-#: lib/rpminstall.c:165
+#: lib/rpminstall.c:171
 #, c-format
 msgid "skipping %s - transfer failed - %s\n"
 msgstr ""
 
-#: lib/rpminstall.c:182
+#: lib/rpminstall.c:188
 #, c-format
 msgid "retrieved %d packages\n"
 msgstr ""
 
-#. XXX Fstrerror
-#: lib/rpminstall.c:192 lib/rpminstall.c:334
+#: lib/rpminstall.c:197 lib/rpminstall.c:339
 #, c-format
-msgid "cannot open file %s\n"
+msgid "cannot open file %s: %s\n"
 msgstr ""
 
-#: lib/rpminstall.c:208 lib/rpminstall.c:473
+#: lib/rpminstall.c:214 lib/rpminstall.c:477
 #, c-format
 msgid "%s cannot be installed\n"
 msgstr ""
 
-#: lib/rpminstall.c:244
+#: lib/rpminstall.c:250
 #, c-format
 msgid "package %s is not relocateable\n"
 msgstr ""
 
-#: lib/rpminstall.c:262
+#: lib/rpminstall.c:268
 #, c-format
 msgid "error reading from file %s\n"
 msgstr ""
 
-#: lib/rpminstall.c:267
+#: lib/rpminstall.c:273
 #, c-format
 msgid "file %s requires a newer version of RPM\n"
 msgstr ""
 
-#: lib/rpminstall.c:284
+#: lib/rpminstall.c:290
 #, c-format
 msgid "found %d source and %d binary packages\n"
 msgstr ""
 
-#: lib/rpminstall.c:295
+#: lib/rpminstall.c:301
 msgid "failed dependencies:\n"
 msgstr ""
 
-#: lib/rpminstall.c:313
+#: lib/rpminstall.c:319
 msgid "installing binary packages\n"
 msgstr ""
 
-#: lib/rpminstall.c:399
+#: lib/rpminstall.c:404
 #, c-format
 msgid "searching for package %s\n"
 msgstr ""
 
-#: lib/rpminstall.c:408
+#: lib/rpminstall.c:413
 #, c-format
 msgid "\"%s\" specifies multiple packages\n"
 msgstr ""
 
-#: lib/rpminstall.c:434
+#: lib/rpminstall.c:439
 msgid "removing these packages would break dependencies:\n"
 msgstr ""
 
-#. XXX Fstrerror
-#: lib/rpminstall.c:462
+#: lib/rpminstall.c:466
 #, c-format
-msgid "cannot open %s\n"
+msgid "cannot open %s: %s\n"
 msgstr ""
 
-#: lib/rpminstall.c:468
+#: lib/rpminstall.c:472
 #, c-format
 msgid "Installing %s\n"
 msgstr ""
 
-#: lib/rpmio.c:327
+#: lib/rpmio.c:339
 msgid "Success"
 msgstr ""
 
-#: lib/rpmio.c:330
+#: lib/rpmio.c:342
 msgid "Bad server response"
 msgstr ""
 
-#: lib/rpmio.c:333
+#: lib/rpmio.c:345
 msgid "Server IO error"
 msgstr ""
 
-#: lib/rpmio.c:336
+#: lib/rpmio.c:348
 msgid "Server timeout"
 msgstr ""
 
-#: lib/rpmio.c:339
+#: lib/rpmio.c:351
 msgid "Unable to lookup server host address"
 msgstr ""
 
-#: lib/rpmio.c:342
+#: lib/rpmio.c:354
 msgid "Unable to lookup server host name"
 msgstr ""
 
-#: lib/rpmio.c:345
+#: lib/rpmio.c:357
 msgid "Failed to connect to server"
 msgstr ""
 
-#: lib/rpmio.c:348
+#: lib/rpmio.c:360
 msgid "Failed to establish data connection to server"
 msgstr ""
 
-#: lib/rpmio.c:351
+#: lib/rpmio.c:363
 msgid "IO error to local file"
 msgstr ""
 
-#: lib/rpmio.c:354
+#: lib/rpmio.c:366
 msgid "Error setting remote server to passive mode"
 msgstr ""
 
-#: lib/rpmio.c:357
+#: lib/rpmio.c:369
 msgid "File not found on server"
 msgstr ""
 
-#: lib/rpmio.c:360
+#: lib/rpmio.c:372
 msgid "Abort in progress"
 msgstr ""
 
-#: lib/rpmio.c:364
+#: lib/rpmio.c:376
 msgid "Unknown or unexpected error"
 msgstr ""
 
-#: lib/rpmio.c:412
+#: lib/rpmio.c:424
 #, c-format
 msgid "logging into %s as %s, pw %s\n"
 msgstr ""
@@ -3118,55 +3113,53 @@ msgstr ""
 msgid "Cannot expand %s"
 msgstr ""
 
-#. XXX Fstrerror
-#: lib/rpmrc.c:557
+#: lib/rpmrc.c:556
 #, c-format
 msgid "Unable to open %s for reading: %s."
 msgstr ""
 
 #. XXX Feof(fd)
-#: lib/rpmrc.c:601
+#: lib/rpmrc.c:600
 #, c-format
 msgid "Failed to read %s: %s."
 msgstr ""
 
-#: lib/rpmrc.c:634
+#: lib/rpmrc.c:633
 #, c-format
 msgid "missing ':' at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:651 lib/rpmrc.c:726
+#: lib/rpmrc.c:650 lib/rpmrc.c:724
 #, c-format
 msgid "missing argument for %s at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:668 lib/rpmrc.c:691
+#: lib/rpmrc.c:667 lib/rpmrc.c:689
 #, c-format
 msgid "%s expansion failed at %s:%d \"%s\""
 msgstr ""
 
-#. XXX Fstrerror
-#: lib/rpmrc.c:678
+#: lib/rpmrc.c:676
 #, c-format
-msgid "cannot open %s at %s:%d"
+msgid "cannot open %s at %s:%d: %s"
 msgstr ""
 
-#: lib/rpmrc.c:718
+#: lib/rpmrc.c:716
 #, c-format
 msgid "missing architecture for %s at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:785
+#: lib/rpmrc.c:783
 #, c-format
 msgid "bad option '%s' at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:1153
+#: lib/rpmrc.c:1151
 #, c-format
 msgid "Unknown system: %s\n"
 msgstr ""
 
-#: lib/rpmrc.c:1154
+#: lib/rpmrc.c:1152
 msgid "Please contact rpm-list@redhat.com\n"
 msgstr ""
 
@@ -3369,6 +3362,21 @@ msgstr ""
 msgid "execution of script failed"
 msgstr ""
 
+#: lib/url.c:71
+#, c-format
+msgid "warning: u %p ctrl nrefs != 0 (%s %s)\n"
+msgstr ""
+
+#: lib/url.c:79
+#, c-format
+msgid "warning: data nrefs != 0 (%s %s)\n"
+msgstr ""
+
+#: lib/url.c:107
+#, c-format
+msgid "warning: uCache[%d] %p nrefs(%d) != 1 (%s %s)\n"
+msgstr ""
+
 #: lib/url.c:207
 #, c-format
 msgid "Password for %s@%s: "
@@ -3384,9 +3392,9 @@ msgid "url port must be a number\n"
 msgstr ""
 
 #. XXX Fstrerror
-#: lib/url.c:425
+#: lib/url.c:426
 #, c-format
-msgid "failed to create %s\n"
+msgid "failed to create %s: %s\n"
 msgstr ""
 
 #: lib/verify.c:38
index 872d0db..8c25635 100644 (file)
@@ -40,14 +40,14 @@ int main(int argc, char **argv)
        break;
     }
 
-#if 0
+#ifdef DYING
     gzdi = gzdFdopen(fdi, "r");        /* XXX gzdi == fdi */
 #else
     gzdi = Fdopen(fdi, "r.gzdio");     /* XXX gzdi == fdi */
 #endif
 
-    while ((ct = Fread(buffer, sizeof(buffer), 1, gzdi)) > 0) {
-       Fwrite(buffer, ct, 1, fdo);
+    while ((ct = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), gzdi)) > 0) {
+       Fwrite(buffer, sizeof(buffer[0]), ct, fdo);
     }
 
     if (ct < 0) {
index 5b9320f..7212960 100644 (file)
@@ -1349,7 +1349,7 @@ int isCompressed(const char *file, int *compressed)
        rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, strerror(errno));
        return 1;
     }
-    nb = Fread(magic, sizeof(magic), 1, fd);
+    nb = Fread(magic, sizeof(char), sizeof(magic), fd);
     rderrno = errno;
     Fclose(fd);