Thu Nov 23 17:52:44 CET 2000 Wichert Akkerman <wakkerma@debian.org>
* lib/fields.c, lib/dump.c: fix two memory leaks
+ * More Adam Heath patches:
+ + lib/mlib.c, include/dpkg.h.in: add new option for do_fd_copy to
+ specify buffersize
+ + dpkg-deb/build.c, lib/info.c, lib/showcright.c: update for new
+ do_fd_copy
+ + dpkg-deb/extract.c: use do_fd_copy to read data instead of reading
+ per character.
+ * lib/mlib.c: fix error reporting for reading data in do_fd_copy
+ * optlib/Makefile.am: remove (can't believe this still existed!)
+ * utils/Makefile.in: link md5sum with our own libintl if needed
+ * archtable, scripts/dpkg-architecture.pl: add freebsd-i386
+ * acconfig.h, configure.in, doc/Makefile.in: make building documentation
+ and start-stop-daemon optional
+ * main/help.c: only check for start-stop-daemon in checkpatch() if we
+ build it
Thu Nov 23 15:48:53 CET 2000 Wichert Akkerman <wakkerma@debian.org>
/* Define the ptrdiff_t type if your system doesn't have it */
#undef ptrdiff_t
+/* Define if start-stop-daemon is compiled */
+#undef USE_START_STOP_DAEMON
hppa-linux-gnu hppa hppa
hppa1.1-linux-gnu hppa hppa
hppa2.0-linux-gnu hppa hppa
+i386-freebsd freebsd-i386 freebsd-i386
esac])
AC_SUBST(DSELECTDIR)
+USE_START_STOP_DAEMON="true"
+AC_ARG_WITH(start-stop-daemon,
+[ --with-start-stop-daemon
+ start and stop system daemons],
+[case "$withval" in
+ "false" | "no" )
+ USE_START_STOP_DAEMON=""
+ ;;
+ esac])
+AC_SUBST(USE_START_STOP_DAEMON)
+if test "$USE_START_STOP_DAEMON" != ""; then
+ AC_DEFINE(USE_START_STOP_DAEMON)
+fi
+
+USE_SGML_DOC="true"
+AC_ARG_WITH(sgml-doc,
+[ --with-sgml-doc SGML documentation converted to HTML],
+[case "$withval" in
+ "false" | "no" )
+ USE_SGML_DOC=""
+ ;;
+ esac])
+AC_SUBST(USE_SGML_DOC)
+
admindir="$libdir/db"
AC_ARG_WITH(admindir,
[ --with-admindir=DIR store dpkg database in DIR [LIBDIR/db]],
MAN5PAGES = deb-control.5 deb-old.5 deb.5
+ifeq (@USE_SGML_DOC@, true)
all: internals.html/index.html all-recursive
+else
+all: all-recursive
+endif
clean: clean-recursive
$(RM) $(srcdir)/manuals-version
if test -f $$i ; then d= ; else d="$(srcdir)/" ; fi ; \
$(INSTALL_DATA) $$d$$i $(DESTDIR)$(man5dir) ; \
done
+ifeq (@USE_SGML_DOC@, true)
$(mkinstalldirs) $(DESTDIR)$(docdir)/internals/
set -e ; for i in internals.html/* ; do \
bn=`basename $$i` ; \
$(INSTALL_DATA) $$i $(DESTDIR)$(docdir)/internals/$$bn ; \
done
+endif
$(INSTALL_DATA) $(srcdir)/ChangeLog $(DESTDIR)$(docdir)/ChangeLog.manuals
set -e ; for i in ChangeLog THANKS TODO ; do \
$(INSTALL_DATA) $(top_srcdir)/$$i $(DESTDIR)$(docdir) ; \
}
if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (control)"));
- do_fd_copy(gzfd, fileno(ar), _("control"));
+ do_fd_copy(gzfd, fileno(ar), -1, _("control"));
/* Control is done, now we need to archive the data. Start by creating
* a new temporary file. Immediately unlink the temporary file so others
combuf = strdup("-9c");
if(compression != NULL) {
if(*compression == '0') {
- do_fd_copy(0, 1, _("no compression copy loop"));
+ do_fd_copy(0, 1, -1, _("no compression copy loop"));
exit(0);
}
combuf[1] = *compression;
werr(debar);
if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (data)"));
- if (!(c3= m_fork())) {
- m_dup2(gzfd,0); m_dup2(fileno(ar),1);
- execlp(CAT,"cat",(char*)0); ohshite(_("failed to exec cat (data)"));
- }
- waitsubproc(c3,"cat (data)",0);
+ do_fd_copy(gzfd, fileno(ar), -1, _("cat (data)"));
if (datastab.st_size & 1)
if (putc('\n',ar) == EOF)
while ((component= *argv++) != 0) {
co= fopen(component,"r");
if (co) {
- do_fd_copy(fileno(co), 1, _("info_spew"));
+ do_fd_copy(fileno(co), 1, -1, _("info_spew"));
} else if (errno == ENOENT) {
if (fprintf(stderr, _("dpkg-deb: `%.255s' contains no control component `%.255s'\n"),
debar, component) == EOF) werr("stderr");
void checksubprocerr(int status, const char *description, int sigpipeok);
void waitsubproc(pid_t pid, const char *description, int sigpipeok);
-int do_fd_copy(int fd1, int fd2, char *desc);
+int do_fd_copy(int fd1, int fd2, int limit, char *desc);
extern volatile int onerr_abort;
checksubprocerr(status,description,sigpipeok);
}
-int do_fd_copy(int fd1, int fd2, char *desc) {
+int do_fd_copy(int fd1, int fd2, int limit, char *desc) {
char *buf, *sbuf;
- int count;
+ int count, bufsize = 32768;
char *er_msg_1 = _("failed to allocate buffer for copy (%s)");
char *er_msg_2 = _("failed in copy on write (%s)");
char *er_msg_3 = _("failed in copy on read (%s)");
snprintf(sbuf, count, er_msg_1, desc);
sbuf[count-1] = 0;
- buf = malloc(32768);
+ if((limit != -1) && (limit < bufsize))
+ bufsize = limit;
+ buf = malloc(bufsize);
if(buf == NULL)
ohshite(sbuf);
free(sbuf);
- count = strlen(er_msg_2) + strlen(desc) + 1;
- sbuf = malloc(count);
- if(sbuf == NULL)
- ohshite(_("failed to allocate buffer for snprintf 2"));
- snprintf(sbuf, count, er_msg_2, desc);
- sbuf[count-1] = 0;
-
- while((count = read(fd1, buf, 32768)) > 0)
- if(write(fd2, buf, count) < count)
- ohshite(sbuf);
-
+ while((count = read(fd1, buf, bufsize)) > 0) {
+ if(write(fd2, buf, count) < count) {
+ count = strlen(er_msg_2) + strlen(desc) + 1;
+ sbuf = malloc(count);
+ if(sbuf == NULL)
+ ohshite(_("failed in copy on write"));
+ snprintf(sbuf, count, er_msg_2, desc);
+ sbuf[count-1] = 0;
+ ohshite(sbuf);
+ }
+ if(limit != -1) {
+ limit -= count;
+ if(limit < bufsize)
+ bufsize = limit;
+ }
+ }
free(sbuf);
- count = strlen(er_msg_3) + strlen(desc) + 1;
- sbuf = malloc(count);
- if(sbuf == NULL)
- ohshite(_("failed to allocate buffer for snprintf 2"));
- snprintf(sbuf, count, er_msg_3, desc);
- sbuf[count-1] = 0;
+ if (count<0) {
+ count = strlen(er_msg_3) + strlen(desc) + 1;
+ sbuf = malloc(count);
+ if(sbuf == NULL)
+ ohshite(_("failed in copy on read"));
+ snprintf(sbuf, count, er_msg_3, desc);
+ sbuf[count-1] = 0;
+ ohsite(sbuf);
+ }
- if(count < 0)
- ohshite(_("failed in copy on read (control)"));
free(sbuf);
free(buf);
}
int fd;
fd= open(COPYINGFILE,O_RDONLY);
if (fd < 0) ohshite(_("cannot open GPL file "));
- do_fd_copy(fd, 1, "showcopyright");
+ do_fd_copy(fd, 1, -1, "showcopyright");
exit(0);
}
void checkpath(void) {
/* Verify that some programs can be found in the PATH. */
- static const char *const checklist[]= {
- "ldconfig", "start-stop-daemon", "install-info", "update-rc.d", 0
+ static const char *const checklist[]= { "ldconfig",
+#ifdef USE_START_STOP_DAEMON
+ "start-stop-daemon",
+#endif
+ "install-info", "update-rc.d", 0
};
struct stat stab;
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-noinst_LIBRARIES = liboptlib.a
-
-EXTRA_DIST = getdate.c
-
-INCLUDES = -I.. -I$(srcdir)
-
-liboptlib_a_SOURCES = getopt.c getopt1.c long-options.c closeout.c
-
-#liboptlib_a_LIBADD = @LIBOBJS@ @ALLOCA@
-liboptlib_a_DEPENDENCIES = $(liboptlib_a_LIBADD)
-
-noinst_HEADERS = getopt.h long-options.h closeout.h error.h
-
-BUILT_SOURCES =
-
-# Remove these files here... they are created locally
-DISTCLEANFILES = $(BUILT_SOURCES) .deps/* *~
-
'sh', 'sh-linux',
'shed', 'shed-linux',
'hppa', 'hppa-linux',
- 'hurd-i386', 'i386-gnu');
+ 'hurd-i386', 'i386-gnu',
+ 'freebsd-i386', 'i386-freebsd');
sub usageversion {
print STDERR
MD5_OBJECTS = $(patsubst %.c, %.o, $(MD5_SOURCES))
MD5_MANPAGES = md5sum.1
-GENFILES = $(SSD_OBJECTS) start-stop-daemon \
- $(MD5_OBJECTS) md5sum
+GENFILES = $(MD5_OBJECTS) md5sum
+ifeq (@USE_START_STOP_DAEMON@, true)
+GENFILES += $(SSD_OBJECTS) start-stop-daemon
+endif
.PHONY: all
+ifeq (@USE_START_STOP_DAEMON@, true)
all:: start-stop-daemon md5sum
+else
+all:: md5sum
+endif
.PHONY: install
install:: all
.PHONY: install-program
install-program:
+ifeq (@USE_START_STOP_DAEMON@, true)
$(mkinstalldirs) $(DESTDIR)/$(sbindir)
$(INSTALL) start-stop-daemon $(DESTDIR)/$(sbindir)
+endif
$(mkinstalldirs) $(DESTDIR)/$(bindir)
$(INSTALL) md5sum $(DESTDIR)/$(bindir)
.PHONY: install-doc
install-doc:
+ifeq (@USE_START_STOP_DAEMON@, true)
$(mkinstalldirs) $(DESTDIR)/$(man8dir)
$(INSTALL_DATA) $(srcdir)/$(SSD_MANPAGES) $(DESTDIR)/$(man8dir)
+endif
$(mkinstalldirs) $(DESTDIR)/$(man1dir)
$(INSTALL_DATA) $(srcdir)/$(MD5_MANPAGES) $(DESTDIR)/$(man1dir)
$(CC) $(LDFLAGS) -o $@ $^ $(SSD_LIBS)
md5sum: $(MD5_OBJECTS) ../optlib/libopt.a
+ $(CC) $(LDFLAGS) -o $@ $^ $(NLS_LIBS)