/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
int token, state, state2 = 0, code = 0, code2 = 0;
int options = lc->options;
RUN **run = (RUN **)(item->value);
- RUN *trun;
char *p;
RES *res;
}
/* Allocate run record, copy new stuff into it,
- * and link it into the list of run records
+ * and append it to the list of run records
* in the schedule resource.
*/
if (pass == 2) {
- trun = (RUN *)malloc(sizeof(RUN));
- memcpy(trun, &lrun, sizeof(RUN));
- if (*run) {
- trun->next = *run;
+ RUN *tail;
+
+ /* Create new run record */
+ RUN *nrun = (RUN *)malloc(sizeof(RUN));
+ memcpy(nrun, &lrun, sizeof(RUN));
+ nrun ->next = NULL;
+
+ if (!*run) { /* if empty list */
+ *run = nrun; /* add new record */
+ } else {
+ for (tail = *run; tail->next; tail=tail->next)
+ { }
+ tail->next = nrun;
}
- *run = trun;
}
lc->options = options; /* restore scanner options */