Description: fortify the build
 Allow compiler flags to be passed in from debian/rules, and fix compile errors caused by hardening.
 .
 cronutils (1.4-2) unstable; urgency=low
 .
   * Update Standards-Version to 3.9.4.
   * Bump debian/compat to 9.
   * Use buildflags.mk in debian/rules to enable hardening flags.
Author: Jamie Wilkinson <jaq@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- cronutils-1.4.orig/runstat.c
+++ cronutils-1.4/runstat.c
@@ -240,7 +240,9 @@ int main(int argc, char ** argv) {
              var->value,
              var->units ? var->units : ""
              );
-    write(temp_fd, buf, strlen(buf));
+    if (write(temp_fd, buf, strlen(buf)) == -1) {
+      perror("write");
+    }
  }
 
   fsync(temp_fd);
--- cronutils-1.4.orig/runlock.c
+++ cronutils-1.4/runlock.c
@@ -63,7 +63,7 @@ int main(int argc, char ** argv) {
   int arg;
   char * command;
   char ** command_args;
-  int status;
+  int status = 0;
   struct flock fl;
   int fd;
   char buf[BUFSIZ];
@@ -156,7 +156,9 @@ int main(int argc, char ** argv) {
       alarm(0);
       sigaction(SIGALRM, &old_sa, NULL);
       snprintf(buf, BUFSIZ, "%d\n", getpid());
-      write(fd, buf, strlen(buf));
+      if (write(fd, buf, strlen(buf)) == -1) {
+        perror("write");
+      }
       fsync(fd);
       syslog(LOG_DEBUG, "lock granted");
       status = run_subprocess(command, command_args, NULL);
--- cronutils-1.4.orig/Makefile
+++ cronutils-1.4/Makefile
@@ -20,8 +20,8 @@ runlock: runlock.c subprocess.c tempdir.
 
 runstat: runstat.c subprocess.c tempdir.c
 
-CFLAGS=-Wall -Werror -Wextra -D_XOPEN_SOURCE=500 -g -O0 -ansi -pedantic-errors -Wwrite-strings -Wcast-align -Wcast-qual -Winit-self -Wformat=2 -Wuninitialized -Wmissing-declarations -Wpointer-arith -Wstrict-aliasing -fstrict-aliasing
-LDLIBS=-lrt
+CFLAGS+=-Wall -Werror -Wextra -D_XOPEN_SOURCE=500 -g -ansi -pedantic-errors -Wwrite-strings -Wcast-align -Wcast-qual -Winit-self -Wformat=2 -Wuninitialized -Wmissing-declarations -Wpointer-arith -Wstrict-aliasing -fstrict-aliasing
+LDLIBS+=-lrt
 
 SOURCES = runalarm.c runlock.c runstat.c subprocess.c subprocess.h tempdir.c tempdir.h Makefile runalarm.1 runlock.1 runstat.1 version examples cronutils.spec runcron
 
