[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r3828 - in trunk/OpenDNSSEC/signer/src: daemon scheduler

Matthijs Mekking matthijs at nlnetlabs.nl
Mon Aug 30 15:00:59 CEST 2010


Author: matthijs
Date: 2010-08-30 15:00:58 +0200 (Mon, 30 Aug 2010)
New Revision: 3828

Modified:
   trunk/OpenDNSSEC/signer/src/daemon/worker.c
   trunk/OpenDNSSEC/signer/src/scheduler/task.c
   trunk/OpenDNSSEC/signer/src/scheduler/task.h
Log:
back up task

Modified: trunk/OpenDNSSEC/signer/src/daemon/worker.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/worker.c	2010-08-30 12:38:28 UTC (rev 3827)
+++ trunk/OpenDNSSEC/signer/src/daemon/worker.c	2010-08-30 13:00:58 UTC (rev 3828)
@@ -106,6 +106,8 @@
                 task = tasklist_schedule_task(worker->tasklist, task, 1);
                 if (!task) {
                     se_log_error("failed to schedule task");
+                } else {
+                    task_backup(task);
                 }
                 lock_basic_unlock(&worker->tasklist->tasklist_lock);
             }

Modified: trunk/OpenDNSSEC/signer/src/scheduler/task.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/scheduler/task.c	2010-08-30 12:38:28 UTC (rev 3827)
+++ trunk/OpenDNSSEC/signer/src/scheduler/task.c	2010-08-30 13:00:58 UTC (rev 3828)
@@ -73,6 +73,36 @@
 
 
 /**
+ * Backup task.
+ *
+ */
+void
+task_backup(task_type* task)
+{
+    char* filename = NULL;
+    FILE* fd = NULL;
+
+    se_log_assert(task);
+
+    filename = se_build_path(task->who, ".task", 0);
+    fd = se_fopen(filename, NULL, "w");
+    if (fd) {
+        fprintf(fd, ";%s\n", ODS_SE_FILE_MAGIC);
+        fprintf(fd, "; who: %s\n", task->who);
+        fprintf(fd, "; what: %i\n", (int) task->what);
+        fprintf(fd, "; when: %s\n", (uint32_t) task->when);
+        fprintf(fd, "; flush: %i\n", task->flush);
+        fprintf(fd, "; backoff: %u\n", (uint32_t) task->backoff);
+        fprintf(fd, ";%s\n", ODS_SE_FILE_MAGIC);
+    } else {
+        se_log_warning("cannot backup task for zone %s: cannot open file %s for "
+        "writing", task->who?task->who:"(null)", filename?filename:"(null)");
+    }
+    return;
+}
+
+
+/**
  * Clean up task.
  *
  */

Modified: trunk/OpenDNSSEC/signer/src/scheduler/task.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/scheduler/task.h	2010-08-30 12:38:28 UTC (rev 3827)
+++ trunk/OpenDNSSEC/signer/src/scheduler/task.h	2010-08-30 13:00:58 UTC (rev 3828)
@@ -100,6 +100,13 @@
     struct zone_struct* zone);
 
 /**
+ * Backup task.
+ * \param[in] task task
+ *
+ */
+void task_backup(task_type* task);
+
+/**
  * Clean up task.
  * \param[in] task task
  *




More information about the Opendnssec-commits mailing list