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