summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-03-26 17:48:20 -0700
committerMichael Forney <mforney@mforney.org>2017-03-26 19:43:34 -0700
commitdace9cee3b56ab5aba789c1b0046a6cb39ac4448 (patch)
treeda6540c791e3bdf5cd4e1b52b4919ccff308a1a4
parent140aa21c99ecd2d84bc42923e510557f672f0424 (diff)
perp: Use clock_gettime for tain_now, and restore umask after perpd_control_init
-rw-r--r--pkg/perp/patch/0001-tain_now-Use-clock_gettime.patch38
-rw-r--r--pkg/perp/patch/0002-perpd-Restore-umask-after-perpd_control_init.patch47
-rw-r--r--pkg/perp/rev2
3 files changed, 86 insertions, 1 deletions
diff --git a/pkg/perp/patch/0001-tain_now-Use-clock_gettime.patch b/pkg/perp/patch/0001-tain_now-Use-clock_gettime.patch
new file mode 100644
index 00000000..fec48466
--- /dev/null
+++ b/pkg/perp/patch/0001-tain_now-Use-clock_gettime.patch
@@ -0,0 +1,38 @@
+From dc52122121b078efbfc914ab256848cc0007c14e Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 26 Mar 2017 17:12:30 -0700
+Subject: [PATCH] tain_now: Use clock_gettime
+
+---
+ lasagna/tain/tain_now.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/lasagna/tain/tain_now.c b/lasagna/tain/tain_now.c
+index 3c790be..ba53864 100644
+--- a/lasagna/tain/tain_now.c
++++ b/lasagna/tain/tain_now.c
+@@ -6,18 +6,17 @@
+
+ #include <stdlib.h>
+ #include <time.h>
+-#include <sys/time.h>
+
+ #include "tain.h"
+
+ struct tain *
+ tain_now(struct tain *t)
+ {
+- struct timeval now;
++ struct timespec now;
+
+- gettimeofday(&now, NULL);
++ clock_gettime(CLOCK_REALTIME, &now);
+ tain_load_utc(t, now.tv_sec);
+- t->nsec = (1000 * now.tv_usec) + 500;
++ t->nsec = now.tv_nsec;
+
+ return t;
+ }
+--
+2.12.1
+
diff --git a/pkg/perp/patch/0002-perpd-Restore-umask-after-perpd_control_init.patch b/pkg/perp/patch/0002-perpd-Restore-umask-after-perpd_control_init.patch
new file mode 100644
index 00000000..699e5cee
--- /dev/null
+++ b/pkg/perp/patch/0002-perpd-Restore-umask-after-perpd_control_init.patch
@@ -0,0 +1,47 @@
+From dc80561853acb99cbd29e555546dfa77ac10d8e1 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 26 Mar 2017 17:28:36 -0700
+Subject: [PATCH] perpd: Restore umask after perpd_control_init
+
+---
+ perp/perpd.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/perp/perpd.c b/perp/perpd.c
+index 2bf5553..1b29577 100644
+--- a/perp/perpd.c
++++ b/perp/perpd.c
+@@ -217,8 +217,9 @@ static
+ void
+ perpd_control_init(void)
+ {
+- int fdbase;
+- int fd = -1;
++ int fdbase;
++ int fd = -1;
++ mode_t umask_orig;
+
+ /* setup for return to base directory: */
+ if((fdbase = open(".", O_RDONLY)) == -1){
+@@ -226,7 +227,7 @@ perpd_control_init(void)
+ }
+
+ /* setup umask for intentional mode on file creation: */
+- umask(0);
++ umask_orig = umask(0);
+
+ /* initialize .control directory: */
+ if(mkdir(PERP_CONTROL, 0700) == -1){
+@@ -286,6 +287,9 @@ perpd_control_init(void)
+ }
+ close(fdbase);
+
++ /* restore umask: */
++ umask(umask_orig);
++
+ return;
+ }
+
+--
+2.12.1
+
diff --git a/pkg/perp/rev b/pkg/perp/rev
index d00491fd..0cfbf088 100644
--- a/pkg/perp/rev
+++ b/pkg/perp/rev
@@ -1 +1 @@
-1
+2