#include <fcntl.h>
#include <pwd.h>
#include <err.h>
+#include <time.h>
+#include <signal.h>
#include <nettle/sha.h>
static void setup_handlers(void);
static void spawn_script(void);
static void queue_alarm(void);
+static void await_something(void);
int main(int argc, const char *const *argv) {
const char *smashedopt, *us;
* and the main program has signals blocked except in sigsuspend, so
* we don't need to worry about async-signal-safety, or errno. */
-static struct stab baseline_time;
+static struct stat baseline_time;
static pid_t script_child, stage2_pgrp;
static bool out_of_date;
static void record_baseline_time(void) {
#ifdef st_mtime
- int r = clock_gettime(CLOCK_REALTIME, &baselime_time.st_mtim);
+ int r = clock_gettime(CLOCK_REALTIME, &baseline_time.st_mtim);
if (r) err(127,"(stage2) clock_gettime");
#else
baseline_time.st_mtime = time(NULL);
static void queue_alarm(void) {
alarm(check_interval);
}
+
+static void await_something(void) {
+ int r;
+ sigset_t mask;
+ sigemptyset(&mask);
+
+ for (;;) {
+ r = sigsuspend(&mask);
+ assert(r==-1);
+ if (r != EINTR) err(127,"(stage2) sigsuspend");
+ }
+}