-#if defined(HAVE_SYSCALL_H) && defined (SYS_gettid)
- reltid = syscall(SYS_gettid);
-#endif
- gettimeofday(&tv, NULL);
- /* Promote to time_t; types differ on some OSes (like darwin) */
- unixtime = tv.tv_sec;
-
- sprintf(tempfilename + len, ".%ld-%ld", reltid, unixtime);
- sc = *scc;
- errno = 0;
- TmpFD = open(tempfilename, O_CREAT|O_EXCL|O_RDWR, S_IRUSR|S_IWUSR);
- Cfg = NewStrBuf();
- if ((TmpFD < 0) || (errno != 0)) {
- syslog(LOG_CRIT, "ERROR: cannot open %s: %s\n",
- filename, strerror(errno));
- free_spoolcontrol_struct(scc);
- unlink(tempfilename);
- }
- else {
- fchown(TmpFD, config.c_ctdluid, 0);
- StrBufAppendPrintf(Cfg, "lastsent|%ld\n", sc->lastsent);
-
- /* Write out the listrecps while freeing from memory at the
- * same time. Am I clever or what? :)
- */
- while (sc->listrecps != NULL) {
- StrBufAppendPrintf(Cfg, "listrecp|%s\n", sc->listrecps->name);
- nptr = sc->listrecps->next;
- free(sc->listrecps);
- sc->listrecps = nptr;
- }
- /* Do the same for digestrecps */
- while (sc->digestrecps != NULL) {
- StrBufAppendPrintf(Cfg, "digestrecp|%s\n", sc->digestrecps->name);
- nptr = sc->digestrecps->next;
- free(sc->digestrecps);
- sc->digestrecps = nptr;
- }
- /* Do the same for participates */
- while (sc->participates != NULL) {
- StrBufAppendPrintf(Cfg, "participate|%s\n", sc->participates->name);
- nptr = sc->participates->next;
- free(sc->participates);
- sc->participates = nptr;
- }
- while (sc->ignet_push_shares != NULL) {
- StrBufAppendPrintf(Cfg, "ignet_push_share|%s", sc->ignet_push_shares->remote_nodename);
- if (!IsEmptyStr(sc->ignet_push_shares->remote_roomname)) {
- StrBufAppendPrintf(Cfg, "|%s", sc->ignet_push_shares->remote_roomname);
- }
- StrBufAppendPrintf(Cfg, "\n");
- mptr = sc->ignet_push_shares->next;
- free(sc->ignet_push_shares);
- sc->ignet_push_shares = mptr;
- }
- if (sc->misc != NULL) {
- StrBufAppendBufPlain(Cfg, sc->misc, -1, 0);