1 diff -urN gtk-vnc-0.3.7.abs/bootstrap gtk-vnc-0.3.7.dan3/bootstrap
2 --- gtk-vnc-0.3.7.abs/bootstrap 1970-01-01 01:00:00.000000000 +0100
3 +++ gtk-vnc-0.3.7.dan3/bootstrap 2008-10-09 15:23:00.000000000 +0100
6 +# Run this after autogen.sh, to pull in all of the gnulib-related bits.
7 +# It's important to run *after* autogen.sh, since it updates some of
8 +# the same files autogen.sh does, yet those from gnulib are newer,
9 +# and match the tests. So if a gnulib bug has been fixed since the
10 +# snapshot taken for whatever gettext release you're using, yet you
11 +# run "make check" against the wrong version, the corresponding unit
12 +# test in gl-tests/ may well fail.
16 +Usage: $0 [OPTION]...
17 +Bootstrap this package from the checked-out sources.
20 + --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
21 + sources reside. Use this if you already
22 + have gnulib sources on your machine, and
23 + do not want to waste your bandwidth downloading
26 +If the file bootstrap.conf exists in the current working directory, its
27 +contents are read as shell variables to configure the bootstrap.
29 +Running without arguments will suffice in most cases.
40 + GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
42 + echo >&2 "$0: $option: unknown option"
53 +case ${GNULIB_SRCDIR--} in
55 + if [ ! -d .gnulib ]; then
56 + echo "$0: getting gnulib files..."
58 + trap cleanup_gnulib 1 2 13 15
60 + git clone --depth 1 git://git.sv.gnu.org/gnulib .gnulib ||
65 + GNULIB_SRCDIR=.gnulib
68 +gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
69 +<$gnulib_tool || exit
83 +# put *.m4 files in new gnulib/m4/ dir
84 +# put *.[ch] files in new gnulib/lib/ dir.
89 + --m4-base=gnulib/m4 \
90 + --source-base=gnulib/lib \
91 + --tests-base=gnulib/tests \
94 diff -urN gtk-vnc-0.3.7.abs/configure.ac gtk-vnc-0.3.7.dan3/configure.ac
95 --- gtk-vnc-0.3.7.abs/configure.ac 2008-09-05 13:32:15.000000000 +0100
96 +++ gtk-vnc-0.3.7.dan3/configure.ac 2008-10-09 15:23:00.000000000 +0100
99 AC_CONFIG_HEADERS([config.h:config.hin])
104 AM_INIT_AUTOMAKE(gtk-vnc, 0.3.7)
107 +dnl gl_INIT uses m4_foreach_w, yet that is not defined in autoconf-2.59.
108 +dnl In order to accommodate developers with such old tools, here's a
109 +dnl replacement definition.
110 +m4_ifndef([m4_foreach_w],
111 + [m4_define([m4_foreach_w],
112 + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
119 +AC_LIBTOOL_WIN32_DLL
123 +AC_CHECK_HEADERS([pwd.h winsock2.h])
126 [ --with-python build python bindings],
127 [case "${withval}" in
132 + gnulib/lib/Makefile
133 + gnulib/tests/Makefile
137 diff -urN gtk-vnc-0.3.7.abs/Makefile.am gtk-vnc-0.3.7.dan3/Makefile.am
138 --- gtk-vnc-0.3.7.abs/Makefile.am 2008-09-05 13:32:15.000000000 +0100
139 +++ gtk-vnc-0.3.7.dan3/Makefile.am 2008-10-09 15:22:57.000000000 +0100
142 -SUBDIRS = src examples plugin
143 +SUBDIRS = gnulib/lib src examples plugin gnulib/tests
145 +ACLOCAL_AMFLAGS = -I gnulib/m4
149 pkgconfig_DATA = @PACKAGE@-1.0.pc
150 pkgconfigdir = $(libdir)/pkgconfig
151 diff -urN gtk-vnc-0.3.7.abs/src/continuation.c gtk-vnc-0.3.7.dan3/src/continuation.c
152 --- gtk-vnc-0.3.7.abs/src/continuation.c 2008-09-05 13:32:16.000000000 +0100
153 +++ gtk-vnc-0.3.7.dan3/src/continuation.c 2008-10-09 15:23:00.000000000 +0100
160 #include "continuation.h"
163 diff -urN gtk-vnc-0.3.7.abs/src/coroutine_gthread.c gtk-vnc-0.3.7.dan3/src/coroutine_gthread.c
164 --- gtk-vnc-0.3.7.abs/src/coroutine_gthread.c 2008-09-05 13:32:16.000000000 +0100
165 +++ gtk-vnc-0.3.7.dan3/src/coroutine_gthread.c 2008-10-09 15:23:00.000000000 +0100
172 #include "coroutine.h"
176 static struct coroutine *current;
177 static struct coroutine leader;
180 +#define CO_DEBUG(OP) fprintf(stderr, "%s %p %s %d\n", OP, g_thread_self(), __FUNCTION__, __LINE__)
182 +#define CO_DEBUG(OP)
185 static void coroutine_system_init(void)
187 - if (!g_thread_supported())
188 + if (!g_thread_supported()) {
194 run_cond = g_cond_new();
195 run_lock = g_mutex_new();
197 + g_mutex_lock(run_lock);
199 /* The thread that creates the first coroutine is the system coroutine
200 * so let's fill out a structure for it */
202 static gpointer coroutine_thread(gpointer opaque)
204 struct coroutine *co = opaque;
207 g_mutex_lock(run_lock);
208 - while (!co->runnable)
209 + while (!co->runnable) {
211 g_cond_wait(run_cond, run_lock);
214 + CO_DEBUG("RUNNABLE");
216 co->data = co->entry(co->data);
219 co->caller->runnable = TRUE;
220 + CO_DEBUG("BROADCAST");
221 g_cond_broadcast(run_cond);
222 + CO_DEBUG("UNLOCK");
223 g_mutex_unlock(run_lock);
228 if (run_cond == NULL)
229 coroutine_system_init();
233 co->thread = g_thread_create_full(coroutine_thread, co, co->stack_size,
235 G_THREAD_PRIORITY_NORMAL,
240 + CO_DEBUG("BROADCAST");
241 g_cond_broadcast(run_cond);
242 + CO_DEBUG("UNLOCK");
243 g_mutex_unlock(run_lock);
246 g_mutex_lock(run_lock);
247 - while (!from->runnable)
248 + while (!from->runnable) {
250 g_cond_wait(run_cond, run_lock);
255 + CO_DEBUG("SWAPPED");
260 fprintf(stderr, "Co-routine is re-entering itself\n");
264 return coroutine_swap(coroutine_self(), to, arg);
268 fprintf(stderr, "Co-routine is yielding to no one\n");
273 coroutine_self()->caller = NULL;
274 return coroutine_swap(coroutine_self(), to, arg);
276 diff -urN gtk-vnc-0.3.7.abs/src/coroutine_ucontext.c gtk-vnc-0.3.7.dan3/src/coroutine_ucontext.c
277 --- gtk-vnc-0.3.7.abs/src/coroutine_ucontext.c 2008-09-05 13:32:16.000000000 +0100
278 +++ gtk-vnc-0.3.7.dan3/src/coroutine_ucontext.c 2008-10-09 15:23:00.000000000 +0100
285 #include <sys/types.h>
286 #include <sys/mman.h>
288 diff -urN gtk-vnc-0.3.7.abs/src/gvnc.c gtk-vnc-0.3.7.dan3/src/gvnc.c
289 --- gtk-vnc-0.3.7.abs/src/gvnc.c 2008-09-05 13:32:16.000000000 +0100
290 +++ gtk-vnc-0.3.7.dan3/src/gvnc.c 2008-10-09 15:23:00.000000000 +0100
299 #include <sys/socket.h>
300 #include <netinet/in.h>
301 #include <arpa/inet.h>
308 #include <gdk/gdkkeysyms.h>
310 #include "vnc_keycodes.h"
311 +#include "getaddrinfo.h"
313 +/* AI_ADDRCONFIG is missing on some systems and gnulib won't provide it
314 + even if its emulated getaddrinfo() for us . */
315 +#ifndef AI_ADDRCONFIG
316 +# define AI_ADDRCONFIG 0
324 g_io_add_watch(channel, cond | G_IO_HUP | G_IO_ERR | G_IO_NVAL, g_io_wait_helper, coroutine_self());
325 ret = coroutine_yield(NULL);
333 if (gvnc->has_error) return -EINVAL;
336 while (offset < len) {
345 if (gvnc->wait_interruptable) {
346 if (!g_io_wait_interruptable(&gvnc->wait,
347 gvnc->channel, G_IO_IN))
352 - GVNC_DEBUG("Closing the connection: gvnc_read() - ret=-1\n");
353 + GVNC_DEBUG("Closing the connection: gvnc_read() - errno=%d\n", errno);
354 gvnc->has_error = TRUE;
357 @@ -436,12 +444,12 @@
358 gvnc->write_offset-offset);
363 g_io_wait(gvnc->channel, G_IO_OUT);
367 - GVNC_DEBUG("Closing the connection: gvnc_flush\n");
368 + GVNC_DEBUG("Closing the connection: gvnc_flush %d\n", errno);
369 gvnc->has_error = TRUE;
372 @@ -1341,12 +1349,12 @@
373 static int gvnc_read_zrle_rl(struct gvnc *gvnc)
380 - byte = gvnc_read_u8(gvnc);
382 - } while (!gvnc_has_error(gvnc) && byte == 255);
383 + b = gvnc_read_u8(gvnc);
385 + } while (!gvnc_has_error(gvnc) && b == 255);
389 @@ -2802,12 +2810,12 @@
390 if (gvnc_has_error(gvnc))
393 - if (!gvnc->fmt.true_color_flag && gvnc->ops.get_preferred_pixel_format)
394 + if (!gvnc->fmt.true_color_flag && gvnc->ops.get_preferred_pixel_format) {
395 if (gvnc->ops.get_preferred_pixel_format(gvnc->ops_data, &gvnc->fmt))
396 gvnc_set_pixel_format(gvnc, &gvnc->fmt);
401 memset(&gvnc->strm, 0, sizeof(gvnc->strm));
402 /* FIXME what level? */
403 for (i = 0; i < 5; i++)
404 @@ -2822,15 +2830,16 @@
405 return !gvnc_has_error(gvnc);
408 -gboolean gvnc_open_fd(struct gvnc *gvnc, int fd)
409 +static gboolean gvnc_set_nonblock(int fd)
412 - if (gvnc_is_open(gvnc)) {
413 - GVNC_DEBUG ("Error: already connected?\n");
415 + unsigned long flags = 1;
416 + if (ioctlsocket(fd, FIONBIO, &flags) < 0) {
417 + GVNC_DEBUG ("Failed to set nonblocking flag\n");
421 - GVNC_DEBUG("Connecting to FD %d\n", fd);
424 if ((flags = fcntl(fd, F_GETFL)) < 0) {
425 GVNC_DEBUG ("Failed to fcntl()\n");
427 @@ -2840,6 +2849,21 @@
428 GVNC_DEBUG ("Failed to fcntl()\n");
435 +gboolean gvnc_open_fd(struct gvnc *gvnc, int fd)
437 + if (gvnc_is_open(gvnc)) {
438 + GVNC_DEBUG ("Error: already connected?\n");
442 + GVNC_DEBUG("Connecting to FD %d\n", fd);
444 + if (!gvnc_set_nonblock(fd))
447 if (!(gvnc->channel = g_io_channel_unix_new(fd))) {
448 GVNC_DEBUG ("Failed to g_io_channel_unix_new()\n");
449 @@ -2873,7 +2897,7 @@
452 while (runp != NULL) {
457 if ((fd = socket(runp->ai_family, runp->ai_socktype,
458 @@ -2883,17 +2907,8 @@
461 GVNC_DEBUG("Trying socket %d\n", fd);
462 - if ((flags = fcntl(fd, F_GETFL)) < 0) {
464 - GVNC_DEBUG ("Failed to fcntl()\n");
467 - flags |= O_NONBLOCK;
468 - if (fcntl(fd, F_SETFL, flags) < 0) {
470 - GVNC_DEBUG ("Failed to fcntl()\n");
473 + if (!gvnc_set_nonblock(fd))
476 if (!(chan = g_io_channel_unix_new(fd))) {
478 @@ -2904,14 +2919,15 @@
480 /* FIXME: Better handle EINPROGRESS/EISCONN return values,
481 as explained in connect(2) man page */
482 - if ( (connect(fd, runp->ai_addr, runp->ai_addrlen) == 0) || errno == EISCONN) {
483 + if ((connect(fd, runp->ai_addr, runp->ai_addrlen) == 0) ||
484 + errno == EISCONN) {
485 gvnc->channel = chan;
488 return !gvnc_has_error(gvnc);
491 - if (errno == EINPROGRESS) {
492 + if (errno == EINPROGRESS ||
493 + errno == EWOULDBLOCK) {
494 g_io_wait(chan, G_IO_OUT|G_IO_ERR|G_IO_HUP);
496 } else if (errno != ECONNREFUSED &&
497 diff -urN gtk-vnc-0.3.7.abs/src/Makefile.am gtk-vnc-0.3.7.dan3/src/Makefile.am
498 --- gtk-vnc-0.3.7.abs/src/Makefile.am 2008-09-05 13:32:15.000000000 +0100
499 +++ gtk-vnc-0.3.7.dan3/src/Makefile.am 2008-10-09 15:23:00.000000000 +0100
501 lib_LTLIBRARIES = libgtk-vnc-1.0.la
503 libgtk_vnc_1_0_la_LIBADD = @GTK_LIBS@ @GTKGLEXT_LIBS@ @GNUTLS_LIBS@ \
506 + ../gnulib/lib/libgnu.la
507 libgtk_vnc_1_0_la_CFLAGS = @GTK_CFLAGS@ @GTKGLEXT_CFLAGS@ @GNUTLS_CFLAGS@ \
508 @GTHREAD_CFLAGS@ @WARNING_CFLAGS@ \
509 -DSYSCONFDIR=\""$(sysconfdir)"\" \
510 - -DG_LOG_DOMAIN=\"gtk-vnc\"
511 + -DG_LOG_DOMAIN=\"gtk-vnc\" \
512 + -I$(top_srcdir)gnulib/lib -I../gnulib/lib
513 libgtk_vnc_1_0_la_LDFLAGS = -Wl, @LD_VERSION_SCRIPT_SUPPORT@ \
514 - -version-info 0:1:0
515 + -version-info 0:1:0 -no-undefined
517 gtk_vnc_includedir = $(includedir)/gtk-vnc-1.0/
518 gtk_vnc_include_HEADERS = vncdisplay.h
519 diff -urN gtk-vnc-0.3.7.abs/src/vncdisplay.c gtk-vnc-0.3.7.dan3/src/vncdisplay.c
520 --- gtk-vnc-0.3.7.abs/src/vncdisplay.c 2008-10-09 15:21:21.000000000 +0100
521 +++ gtk-vnc-0.3.7.dan3/src/vncdisplay.c 2008-10-09 15:23:00.000000000 +0100
528 #include "vncdisplay.h"
529 #include "coroutine.h"
532 #include <sys/types.h>
533 #include <sys/stat.h>
540 #include <gtk/gtkgl.h>
541 @@ -2191,33 +2195,44 @@
543 static int vnc_display_set_x509_credential(VncDisplay *obj, const char *name)
545 - char sysdir[PATH_MAX], userdir[PATH_MAX];
548 + char sysdir[PATH_MAX];
550 + char userdir[PATH_MAX];
552 char *dirs[] = { sysdir, userdir };
554 + char *dirs[] = { sysdir };
557 strncpy(sysdir, SYSCONFDIR "/pki", PATH_MAX-1);
558 sysdir[PATH_MAX-1] = '\0';
561 if (!(pw = getpwuid(getuid())))
564 snprintf(userdir, PATH_MAX-1, "%s/.pki", pw->pw_dir);
565 userdir[PATH_MAX-1] = '\0';
568 - if (vnc_display_best_path(file, PATH_MAX, "CA", "cacert.pem", dirs, 2) < 0)
569 + if (vnc_display_best_path(file, PATH_MAX, "CA", "cacert.pem",
570 + dirs, sizeof(dirs)/sizeof(dirs[0])) < 0)
572 gvnc_set_credential_x509_cacert(obj->priv->gvnc, file);
574 /* Don't mind failures of CRL */
575 - if (vnc_display_best_path(file, PATH_MAX, "CA", "cacrl.pem", dirs, 2) == 0)
576 + if (vnc_display_best_path(file, PATH_MAX, "CA", "cacrl.pem",
577 + dirs, sizeof(dirs)/sizeof(dirs[0])) == 0)
578 gvnc_set_credential_x509_cacert(obj->priv->gvnc, file);
580 /* Set client key & cert if we have them. Server will reject auth
581 * if it decides it requires them*/
582 - if (vnc_display_best_path(file, PATH_MAX, name, "private/clientkey.pem", dirs, 2) == 0)
583 + if (vnc_display_best_path(file, PATH_MAX, name, "private/clientkey.pem",
584 + dirs, sizeof(dirs)/sizeof(dirs[0])) == 0)
585 gvnc_set_credential_x509_key(obj->priv->gvnc, file);
586 - if (vnc_display_best_path(file, PATH_MAX, name, "clientcert.pem", dirs, 2) == 0)
587 + if (vnc_display_best_path(file, PATH_MAX, name, "clientcert.pem",
588 + dirs, sizeof(dirs)/sizeof(dirs[0])) == 0)
589 gvnc_set_credential_x509_cert(obj->priv->gvnc, file);
592 diff -urN gtk-vnc-0.3.7.abs/vc-list-files gtk-vnc-0.3.7.dan3/vc-list-files
593 --- gtk-vnc-0.3.7.abs/vc-list-files 1970-01-01 01:00:00.000000000 +0100
594 +++ gtk-vnc-0.3.7.dan3/vc-list-files 2008-10-09 15:23:00.000000000 +0100
597 +# List version-controlled file names.
599 +# Print a version string.
600 +scriptversion=2008-07-11.19
602 +# Copyright (C) 2006-2008 Free Software Foundation, Inc.
604 +# This program is free software: you can redistribute it and/or modify
605 +# it under the terms of the GNU General Public License as published by
606 +# the Free Software Foundation, either version 3 of the License, or
607 +# (at your option) any later version.
609 +# This program is distributed in the hope that it will be useful,
610 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
611 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
612 +# GNU General Public License for more details.
614 +# You should have received a copy of the GNU General Public License
615 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
618 +# List the specified version-controlled files.
619 +# With no argument, list them all. With a single DIRECTORY argument,
620 +# list the version-controlled files in that directory.
622 +# If there's an argument, it must be a single, "."-relative directory name.
623 +# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
628 +Usage: $0 [-C SRCDIR] [DIR]
630 +Output a list of version-controlled files in DIR (default .), relative to
631 +SRCDIR (default .). SRCDIR must be the top directory of a checkout.
634 + --help print this help, then exit
635 + --version print version number, then exit
636 + -C SRCDIR change directory to SRCDIR before generating list
638 +Report bugs and patches to <bug-gnulib@gnu.org>.
643 + year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
645 +vc-list-files $scriptversion
646 +Copyright (C) $year Free Software Foundation, Inc,
647 +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
648 +This is free software: you are free to change and redistribute it.
649 +There is NO WARRANTY, to the extent permitted by law.
654 + test "$2" = . || postprocess="| sed 's|^|$2/|'"
663 + *) echo "$0: too many arguments" 1>&2
664 + echo "Usage: $0 [-C srcdir] [DIR]" 1>&2; exit 1;;
667 +test "x$dir" = x && dir=.
669 +if test -d .git; then
670 + eval exec git ls-files '"$dir"' $postprocess
671 +elif test -d .hg; then
672 + eval exec hg locate '"$dir/*"' $postprocess
673 +elif test -d .bzr; then
674 + test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
675 + eval exec bzr ls --versioned '"$dir"' $postprocess
676 +elif test -d CVS; then
677 + test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
678 + if test -x build-aux/cvsu; then
679 + eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
680 + elif (cvsu --help) >/dev/null 2>&1; then
681 + eval cvsu --find --types=AFGM '"$dir"' $postprocess
683 + eval awk -F/ \''{ \
684 + if (!$1 && $3 !~ /^-/) { \
686 + if (f ~ /CVS\/Entries$/) \
687 + f = substr(f, 0, length(f)-11); \
690 + `find "$dir" -name Entries -print` /dev/null' $postprocess
693 + echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
698 +# eval: (add-hook 'write-file-hooks 'time-stamp)
699 +# time-stamp-start: "scriptversion="
700 +# time-stamp-format: "%:y-%02m-%02d.%02H"
701 +# time-stamp-end: "$"