Subject: Collected Debian patches for remctl
Author: Russ Allbery <rra@debian.org>

Since I am also upstream for this package, there will normally not be any
patches to apply to the upstream source.  However, occasionally I'll pull
up specific upstream commits prior to making an upstream release.  When
this happens, this patch will collect all of those modifications.

I use Git to maintain both the upstream source and the Debian packages,
and generating individual patches rather than using git cherry-pick takes
extra work for no gain.  Since I'm also upstream, there's no need to
separate the patches for later upstream submission.  Hence, I take this
approach with a unified patch when it's necessary.

For full commit history and separated commits, see the upstream Git
repsitory.
--- remctl-3.2.orig/Makefile.am
+++ remctl-3.2/Makefile.am
@@ -444,7 +444,8 @@ BINDINGS_INSTALL =
 # which case we need to copy various files from the source directory and make
 # sure they're up to date since Perl can't handle VPATH builds.
 
-perl/Remctl.o: perl/Remctl.pm $(srcdir)/perl/Remctl.xs $(srcdir)/perl/typemap
+perl/Remctl.o: perl/Remctl.pm $(srcdir)/perl/Remctl.xs	\
+		$(srcdir)/perl/typemap client/libremctl.la
 	set -e; if [ x"$(builddir)" != x"$(srcdir)" ] ; then	\
 	    for f in $(PERL_FILES) ; do				\
 	        cp "$(srcdir)/$$f" "$(builddir)/$$f" ;		\
@@ -465,7 +466,7 @@ endif
 # The following section sets up the PECL extension for PHP.
 
 php/modules/remctl.so: php/config.m4 php/php_remctl.h \
-		$(srcdir)/php/php_remctl.c
+		$(srcdir)/php/php_remctl.c client/libremctl.la
 	set -e; if [ x"$(builddir)" != x"$(srcdir)" ] ; then	\
 	    mkdir php/tests 2>/dev/null || true ;		\
 	    for f in $(PHP_FILES) ; do				\
@@ -492,7 +493,8 @@ endif
 # in which case we need to copy various files from the source directory and
 # make sure they're up to date.
 
-stamp-python: $(srcdir)/python/_remctlmodule.c python/remctl.py
+stamp-python: $(srcdir)/python/_remctlmodule.c python/remctl.py	\
+		client/libremctl.la
 	set -e; if [ x"$(builddir)" != x"$(srcdir)" ] ; then	\
 	    for f in $(PYTHON_FILES) ; do			\
 		cp "$(srcdir)/$$f" "$(builddir)/$$f" ;		\
@@ -530,7 +532,7 @@ endif
 # The following section sets up the Ruby bindings for remctl.
 
 # The Ruby build system actually supports VPATH!
-ruby/remctl.so: ruby/extconf.rb $(srcdir)/ruby/remctl.c
+ruby/remctl.so: ruby/extconf.rb $(srcdir)/ruby/remctl.c client/libremctl.la
 	cd ruby && $(REMCTL_RUBY) extconf.rb
 	cd ruby && $(MAKE) CFLAGS="$(CFLAGS) $(RUBY_WARNINGS)"
 
--- remctl-3.2.orig/tests/client/open-t.c
+++ remctl-3.2/tests/client/open-t.c
@@ -79,7 +79,7 @@ accept_connection(char *pidfile, int pro
         sysdie("error binding socket");
     if (listen(s, 1) < 0)
         sysdie("error listening to socket");
-    fd = open(pidfile, O_CREAT | O_TRUNC, 0666);
+    fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
     if (fd < 0)
         sysdie("cannot create sentinal");
     close(fd);
--- remctl-3.2.orig/tests/util/tokens-t.c
+++ remctl-3.2/tests/util/tokens-t.c
@@ -63,7 +63,7 @@ create_server(void)
         sysbail("error binding socket");
     if (listen(fd, 1) < 0)
         sysbail("error listening on socket");
-    marker = open("server-ready", O_CREAT | O_TRUNC, 0666);
+    marker = open("server-ready", O_WRONLY | O_CREAT | O_TRUNC, 0666);
     if (marker < 0)
         sysbail("cannot create marker file");
     conn = accept(fd, NULL, 0);
--- remctl-3.2.orig/server/config.c
+++ remctl-3.2/server/config.c
@@ -632,6 +632,7 @@ acl_check_file_internal(void *data, cons
             return s;
         }
     }
+    fclose(file);
     return CONFIG_NOMATCH;
 
 fail:
