summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-11-15 22:16:54 +0000
committerjbj <devnull@localhost>1999-11-15 22:16:54 +0000
commit07fa5616811da29b4e4630288864f858b019e77f (patch)
treedefc1d62be53efc04ae204be1438f98ab4236656 /lib
parent4e62a322a266e9d95007540d10e67fc75bf80aa7 (diff)
downloadrpm-07fa5616811da29b4e4630288864f858b019e77f.tar.gz
rpm-07fa5616811da29b4e4630288864f858b019e77f.tar.bz2
rpm-07fa5616811da29b4e4630288864f858b019e77f.zip
rpm.c: Add --ftpdebug, --urldebug, --rpmiodebug (for my sanity).
build/pack.c: Remove unnecessary persist in package{Sources,Binaries}. lib/rpmio.c: Expose fdGetFp() for use in url.c. lib/rpmio.c: Debug refs with FILE/FTP/HTTP url's. lib/url.c: Push fp in order to use Fclose() when cleaning up url cache. CVS patchset: 3425 CVS date: 1999/11/15 22:16:54
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmio.h79
-rw-r--r--lib/url.c28
2 files changed, 62 insertions, 45 deletions
diff --git a/lib/rpmio.h b/lib/rpmio.h
index 1f9df01f4..72b6fb86e 100644
--- a/lib/rpmio.h
+++ b/lib/rpmio.h
@@ -39,26 +39,26 @@ typedef int fdio_lstat_function_t (const char * path, struct stat * st);
typedef int fdio_access_function_t (const char * path, int amode);
struct FDIO_s {
- cookie_read_function_t *read;
- cookie_write_function_t *write;
- cookie_seek_function_t *seek;
- cookie_close_function_t *close;
-
- fdio_ref_function_t *ref;
- fdio_deref_function_t *deref;
- fdio_new_function_t *new;
- fdio_fileno_function_t *fileno;
-
- fdio_open_function_t *open;
- fdio_fopen_function_t *fopen;
- fdio_ffileno_function_t *ffileno;
- fdio_fflush_function_t *fflush;
-
- fdio_mkdir_function_t *mkdir;
- fdio_chdir_function_t *chdir;
- fdio_rmdir_function_t *rmdir;
- fdio_rename_function_t *rename;
- fdio_unlink_function_t *unlink;
+ cookie_read_function_t * read;
+ cookie_write_function_t * write;
+ cookie_seek_function_t * seek;
+ cookie_close_function_t * close;
+
+ fdio_ref_function_t * ref;
+ fdio_deref_function_t * deref;
+ fdio_new_function_t * new;
+ fdio_fileno_function_t * fileno;
+
+ fdio_open_function_t * open;
+ fdio_fopen_function_t * fopen;
+ fdio_ffileno_function_t * ffileno;
+ fdio_fflush_function_t * fflush;
+
+ fdio_mkdir_function_t * mkdir;
+ fdio_chdir_function_t * chdir;
+ fdio_rmdir_function_t * rmdir;
+ fdio_rename_function_t * rename;
+ fdio_unlink_function_t * unlink;
};
/*@observer@*/ const char * Fstrerror(FD_t fd);
@@ -89,23 +89,24 @@ int Access (const char * path, int amode);
/*@observer@*/ extern FDIO_t gzdio;
-void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno);
-void fdPop(FD_t fd);
+void fdPush (FD_t fd, FDIO_t io, void * fp, int fdno);
+void fdPop (FD_t fd);
-void fdSetFdno(FD_t fd, int fdno);
-off_t fdSize(FD_t fd);
-void fdSetSyserrno(FD_t fd, int syserrno, const void * errcookie);
+void * fdGetFp (FD_t fd);
+void fdSetFdno(FD_t fd, int fdno);
+off_t fdSize (FD_t fd);
+void fdSetSyserrno(FD_t fd, int syserrno, const void * errcookie);
/*@null@*/ const FDIO_t fdGetIo(FD_t fd);
-void fdSetIo(FD_t fd, FDIO_t io);
+void fdSetIo (FD_t fd, FDIO_t io);
-int fdGetRdTimeoutSecs(FD_t fd);
+int fdGetRdTimeoutSecs(FD_t fd);
-int fdGetFtpFileDoneNeeded(FD_t fd);
-void fdSetFtpFileDoneNeeded(FD_t fd, int ftpFileDoneNeeded);
+int fdGetFtpFileDoneNeeded(FD_t fd);
+void fdSetFtpFileDoneNeeded(FD_t fd, int ftpFileDoneNeeded);
long int fdGetCpioPos(FD_t fd);
-void fdSetCpioPos(FD_t fd, long int cpioPos);
+void fdSetCpioPos(FD_t fd, long int cpioPos);
extern /*@null@*/ FD_t fdDup(int fdno);
#ifdef UNUSED
@@ -137,8 +138,8 @@ extern /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
/*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd);
/*@observer@*/ const char * urlStrerror(const char * url);
-int ufdCopy(FD_t sfd, FD_t tfd);
-int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd);
+int ufdCopy(FD_t sfd, FD_t tfd);
+int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd);
const char *const ftpStrerror(int errorNumber);
#if 0
@@ -161,23 +162,23 @@ const char *const ftpStrerror(int errorNumber);
#define ufdUnlink ufdio->unlink
#endif
-int fdWritable(FD_t fd, int secs);
-int fdReadable(FD_t fd, int secs);
-int fdRdline(FD_t fd, /*@out@*/ char * buf, size_t len);
+int fdWritable(FD_t fd, int secs);
+int fdReadable(FD_t fd, int secs);
+int fdRdline(FD_t fd, /*@out@*/ char * buf, size_t len);
-int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length);
+int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length);
+#define timedRead ufdio->read
/*@observer@*/ extern FDIO_t ufdio;
-#define timedRead ufdio->read
/*
* Support for first fit File Allocation I/O.
*/
long int fadGetFileSize(FD_t fd);
-void fadSetFileSize(FD_t fd, long int fileSize);
+void fadSetFileSize(FD_t fd, long int fileSize);
unsigned int fadGetFirstFree(FD_t fd);
-void fadSetFirstFree(FD_t fd, unsigned int firstFree);
+void fadSetFirstFree(FD_t fd, unsigned int firstFree);
/*@observer@*/ extern FDIO_t fadio;
diff --git a/lib/url.c b/lib/url.c
index 63b49511d..6b3d1ba1c 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -64,22 +64,38 @@ DBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, li
if (--u->nrefs > 0)
return u;
if (u->ctrl) {
- void * uctrl = u->ctrl;
- if (fdio->fileno(u->ctrl) >= 0)
+#ifndef NOTYET
+ FILE * fp = fdGetFp(u->ctrl);
+ if (fp) {
+ fdPush(u->ctrl, fpio, fp, fileno(fp)); /* Push fpio onto stack */
+ Fclose(u->ctrl);
+ } else if (fdio->fileno(u->ctrl) >= 0)
fdio->close(u->ctrl);
+#else
+ Fclose(u->ctrl);
+#endif
+
u->ctrl = fdio->deref(u->ctrl, "persist ctrl (urlFree)", file, line);
if (u->ctrl)
fprintf(stderr, _("warning: u %p ctrl %p nrefs != 0 (%s %s)\n"),
- u, uctrl, u->host, u->service);
+ u, u->ctrl, u->host, u->service);
}
if (u->data) {
- void * udata = u->data;
- if (fdio->fileno(u->data) >= 0)
+#ifndef NOTYET
+ FILE * fp = fdGetFp(u->data);
+ if (fp) {
+ fdPush(u->data, fpio, fp, fileno(fp)); /* Push fpio onto stack */
+ Fclose(u->data);
+ } else if (fdio->fileno(u->data) >= 0)
fdio->close(u->data);
+#else
+ Fclose(u->ctrl);
+#endif
+
u->data = fdio->deref(u->data, "persist data (urlFree)", file, line);
if (u->data)
fprintf(stderr, _("warning: u %p data %p nrefs != 0 (%s %s)\n"),
- u, udata, u->host, u->service);
+ u, u->data, u->host, u->service);
}
if (u->buf) {
free(u->buf);