xref: /netbsd-src/external/ibm-public/postfix/dist/src/global/deliver_completed.c (revision 41fbaed053f8fbfdf9d2a4ee0a7386a3c83f8505)
1 /*	$NetBSD: deliver_completed.c,v 1.1.1.1 2009/06/23 10:08:45 tron Exp $	*/
2 
3 /*++
4 /* NAME
5 /*	deliver_completed 3
6 /* SUMMARY
7 /*	recipient delivery completion
8 /* SYNOPSIS
9 /*	#include <deliver_completed.h>
10 /*
11 /*	void	deliver_completed(stream, offset)
12 /*	VSTREAM	*stream;
13 /*	long	offset;
14 /* DESCRIPTION
15 /*	deliver_completed() crosses off the specified recipient from
16 /*	an open queue file. A -1 offset means ignore the request -
17 /*	this is used for delivery requests that are passed on from
18 /*	one delivery agent to another.
19 /* DIAGNOSTICS
20 /*	Fatal error: unable to update the queue file.
21 /* LICENSE
22 /* .ad
23 /* .fi
24 /*	The Secure Mailer license must be distributed with this software.
25 /* AUTHOR(S)
26 /*	Wietse Venema
27 /*	IBM T.J. Watson Research
28 /*	P.O. Box 704
29 /*	Yorktown Heights, NY 10598, USA
30 /*--*/
31 
32 /* System library. */
33 
34 #include <sys_defs.h>
35 
36 /* Utility library. */
37 
38 #include <msg.h>
39 #include <vstream.h>
40 
41 /* Global library. */
42 
43 #include "record.h"
44 #include "rec_type.h"
45 #include "deliver_completed.h"
46 
47 /* deliver_completed - handle per-recipient delivery completion */
48 
deliver_completed(VSTREAM * stream,long offset)49 void    deliver_completed(VSTREAM *stream, long offset)
50 {
51     const char *myname = "deliver_completed";
52 
53     if (offset == -1)
54 	return;
55 
56     if (offset <= 0)
57 	msg_panic("%s: bad offset %ld", myname, offset);
58 
59     if (rec_put_type(stream, REC_TYPE_DONE, offset) < 0
60 	|| vstream_fflush(stream))
61 	msg_fatal("update queue file %s: %m", VSTREAM_PATH(stream));
62 }
63