Re: [PATCH] Fix typo in Message.maildir_flags_to_tags
[notmuch-archives.git] / 30 / ff801ae5ae99b5f7abfb380a6e02bd0ebddc0e
1 Return-Path: <too@nixu.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 62CA4429E25\r
6         for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 01:02:00 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id PnJ1Cjn91Gd1 for <notmuch@notmuchmail.org>;\r
16         Tue, 13 Dec 2011 01:01:59 -0800 (PST)\r
17 Received: from mail-gw3.nixu.fi (mail-gw3.nixu.fi [193.209.237.7])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 0AED4429E26\r
21         for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 01:01:58 -0800 (PST)\r
22 Received: from pps.filterd (mail-gw3 [127.0.0.1])\r
23         by mail-gw3.nixu.fi (8.14.4/8.14.4) with SMTP id pBD90UGW025406;\r
24         Tue, 13 Dec 2011 11:01:47 +0200\r
25 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
26         by mail-gw3.nixu.fi with ESMTP id 114cs0t045-1\r
27         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
28         Tue, 13 Dec 2011 11:01:47 +0200\r
29 Received: from taco2.nixu.fi (localhost [127.0.0.1])\r
30         by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id\r
31         pBD91kb8022818\r
32         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);\r
33         Tue, 13 Dec 2011 11:01:46 +0200\r
34 Received: (from too@localhost)\r
35         by taco2.nixu.fi (8.14.3/8.14.3/Submit) id pBD91jnC022817;\r
36         Tue, 13 Dec 2011 11:01:45 +0200\r
37 From: Tomi Ollila <tomi.ollila@iki.fi>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH 1/2] test/smtp-dummy: add --background option for going\r
40         background after listen(2)\r
41 Date: Tue, 13 Dec 2011 11:01:22 +0200\r
42 Message-Id: <1323766883-17607-1-git-send-email-tomi.ollila@iki.fi>\r
43 X-Mailer: git-send-email 1.7.7.3\r
44 In-Reply-To: <20111212161800.GO2760@mit.edu>\r
45 References: <20111212161800.GO2760@mit.edu>\r
46 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110,\r
47  1.0.211,       0.0.0000        definitions=2011-12-13_03:2011-12-13, 2011-12-12,\r
48         1970-01-01 signatures=0\r
49 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0\r
50         ipscore=0 suspectscore=1\r
51         phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0\r
52         reason=mlx\r
53         scancount=1 engine=6.0.2-1012030000 definitions=main-1112130013\r
54 Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Tue, 13 Dec 2011 09:02:00 -0000\r
68 \r
69 To avoid the possibility that smtp-dummy doesn't have chance to bind\r
70 its listening socket until something tries to send message to it this\r
71 option makes caller wait until socket is already listening for connections.\r
72 \r
73 In case this --background option is used, the pid of running smtp-dummy\r
74 is printed on stdout.\r
75 ---\r
76 \r
77 Resent after whitespace-cleanup in patch 1/2 (this patch).\r
78 \r
79  test/smtp-dummy.c |   35 ++++++++++++++++++++++++++++++++++-\r
80  1 files changed, 34 insertions(+), 1 deletions(-)\r
81 \r
82 diff --git a/test/smtp-dummy.c b/test/smtp-dummy.c\r
83 index 3801a5e..9126c00 100644\r
84 --- a/test/smtp-dummy.c\r
85 +++ b/test/smtp-dummy.c\r
86 @@ -124,9 +124,21 @@ main (int argc, char *argv[])\r
87         struct hostent *hostinfo;\r
88         socklen_t peer_addr_len;\r
89         int reuse;\r
90 +       int bg;\r
91 +\r
92 +       /* XXX Quick implementation -- fix if more functionality is desired. */\r
93 +       if (argc >= 2 && strcmp(argv[1], "--background") == 0) {\r
94 +               argc--;\r
95 +               argv[1] = argv[0];\r
96 +               argv++;\r
97 +               bg = 1;\r
98 +       }\r
99 +       else\r
100 +               bg = 0;\r
101  \r
102         if (argc != 2) {\r
103 -               fprintf (stderr, "Usage: %s <output-file>\n", argv[0]);\r
104 +               fprintf (stderr, "Usage: %s [--background] <output-file>\n",\r
105 +                        argv[0]);\r
106                 return 1;\r
107         }\r
108  \r
109 @@ -179,7 +191,27 @@ main (int argc, char *argv[])\r
110                 return 1;\r
111         }\r
112  \r
113 +       if (bg) {\r
114 +               int pid = fork ();\r
115 +               if (pid > 0) {\r
116 +                       printf ("%d\n", pid);\r
117 +                       return 0;\r
118 +               }\r
119 +               if (pid < 0) {\r
120 +                       fprintf (stderr, "Error: fork() failed: %s\n",\r
121 +                                strerror (errno));\r
122 +                       close (sock);\r
123 +                       return 1;\r
124 +               }\r
125 +               /* Reached if pid == 0. */\r
126 +               /* Close stdout so that the one interested in pid value will\r
127 +                  also get EOF. */\r
128 +               close (1);\r
129 +               /* dup2() will re-reserve fd 1 (opportunistically, in case fd 2\r
130 +                  is open. If that was not open we don't care fd 1 either.) */\r
131 +               dup2 (2, 1);\r
132 +       }\r
133 +\r
134         peer_addr_len = sizeof (peer_addr);\r
135         peer = accept (sock, (struct sockaddr *) &peer_addr, &peer_addr_len);\r
136         if (peer == -1) {\r
137 -- \r
138 1.7.7.3\r
139 \r