dma-lock-delivery.diff

roe, 07/03/2009 10:27 PM

Download (1018 Bytes)

View differences:

libexec/dma/dma.c 2009-07-04 00:12:53.000000000 +0200
612 612
	const char *errmsg = "unknown bounce reason";
613 613
	struct timeval now;
614 614
	struct stat st;
615
	struct flock fl;
615 616

  
616 617
	syslog(LOG_INFO, "%s: mail from=<%s> to=<%s>",
617 618
	       it->queueid, it->sender, it->addr);
......
620 621
	syslog(LOG_INFO, "%s: trying delivery",
621 622
	       it->queueid);
622 623

  
624
	bzero(&fl, sizeof(fl));
625
	fl.l_type = F_WRLCK;
626
	fl.l_whence = SEEK_SET;
627
	if (fcntl(fileno(it->queuef), F_SETLKW, &fl) == -1) {
628
		syslog(LOG_ERR, "%s: failed to lock queue file: %m",
629
				it->queueid);
630
	}
631

  
623 632
	if (it->remote)
624 633
		error = deliver_remote(it, &errmsg);
625 634
	else
626 635
		error = deliver_local(it, &errmsg);
627 636

  
637
	bzero(&fl, sizeof(fl));
638
	fl.l_type = F_UNLCK;
639
	fl.l_whence = SEEK_SET;
640
	if (fcntl(fileno(it->queuef), F_SETLKW, &fl) == -1) {
641
		syslog(LOG_ERR, "%s: failed to unlock queue file: %m",
642
				it->queueid);
643
	}
644

  
628 645
	switch (error) {
629 646
	case 0:
630 647
		unlink(it->queuefn);