Lines Matching refs:it

68  * One data file might be shared by linking it several times.
125 writequeuef(struct qitem *it)
130 queuefd = open_locked(it->queuefn, O_CREAT|O_EXCL|O_RDWR, 0660);
135 it->queuef = fdopen(queuefd, "w+");
136 if (it->queuef == NULL)
139 error = fprintf(it->queuef,
143 it->queueid,
144 it->sender,
145 it->addr);
150 if (fflush(it->queuef) != 0 || fsync(fileno(it->queuef)) != 0)
164 struct qitem *it = NULL;
215 it = LIST_FIRST(&itmqueue.queue);
216 it->sender = sender; sender = NULL;
217 it->queueid = queueid; queueid = NULL;
218 it->queuefn = queuefn; queuefn = NULL;
219 LIST_INSERT_HEAD(&queue->queue, it, next);
231 return (it);
238 struct qitem *it;
246 LIST_FOREACH(it, &queue->queue, next) {
247 if (asprintf(&it->queueid, "%s.%"PRIxPTR, queue->id, (uintptr_t)it) <= 0)
249 if (asprintf(&it->queuefn, "%s/Q%s", config.spooldir, it->queueid) <= 0)
251 if (asprintf(&it->mailfn, "%s/M%s", config.spooldir, it->queueid) <= 0)
255 if (stat(it->queuefn, &st) == 0 || stat(it->mailfn, &st) == 0)
258 if (writequeuef(it) != 0)
261 if (link(queue->tmpf, it->mailfn) != 0)
265 LIST_FOREACH(it, &queue->queue, next) {
267 it->addr, it->queueid);
274 LIST_FOREACH(it, &queue->queue, next) {
275 unlink(it->mailfn);
276 unlink(it->queuefn);
285 struct qitem *it;
313 * Move on if it turns out to be something else than a file.
325 it = readqueuef(queue, queuefn);
326 if (it == NULL)
329 it->mailfn = mailfn;
347 delqueue(struct qitem *it)
349 unlink(it->mailfn);
350 unlink(it->queuefn);
351 if (it->queuef != NULL)
352 fclose(it->queuef);
353 if (it->mailf != NULL)
354 fclose(it->mailf);
355 free(it);
359 acquirespool(struct qitem *it)
363 if (it->queuef == NULL) {
364 queuefd = open_locked(it->queuefn, O_RDWR|O_NONBLOCK);
367 it->queuef = fdopen(queuefd, "r+");
368 if (it->queuef == NULL)
372 if (it->mailf == NULL) {
373 it->mailf = fopen(it->mailfn, "r");
374 if (it->mailf == NULL)
390 struct qitem *it;
392 LIST_FOREACH(it, &queue->queue, next) {
393 if (it == keep)
396 if (it->queuef != NULL)
397 fclose(it->queuef);
398 if (it->mailf != NULL)
399 fclose(it->mailf);