]> git.pld-linux.org Git - packages/postfix.git/blame - postfix-vda-bigquota.patch
- up to 3.6.15
[packages/postfix.git] / postfix-vda-bigquota.patch
CommitLineData
ca9e223e
JR
1diff -ur postfix-2.7.0/src/virtual/maildir.c postfix-2.7.0-bg/src/virtual/maildir.c
2--- postfix-2.7.0/src/virtual/maildir.c 2010-04-15 16:46:03.766130197 +0200
3+++ postfix-2.7.0-bg/src/virtual/maildir.c 2010-04-15 16:55:02.496126981 +0200
4@@ -65,6 +65,7 @@
5
6 /* Patch library. */
7
8+#include <stdint.h>
9 #include <sys/types.h> /* opendir(3), stat(2) */
10 #include <sys/stat.h> /* stat(2) */
11 #include <dirent.h> /* opendir(3) */
12@@ -98,14 +99,14 @@
13 * Returns the size of all mails as read from maildirsize,
14 * zero if it couldn't read the file.
15 */
16-static long read_maildirsize(char *filename, long *sumptr, long *countptr)
17+static long read_maildirsize(char *filename, int64_t *sumptr, int64_t *countptr)
18 {
19 char *myname = "read_maildirsize";
20 struct stat statbuf;
21 VSTREAM *sizefile;
22 char *p;
23 int len, first;
24- long sum = 0, count = 0, ret_value = -1;
25+ int64_t sum = 0, count = 0, ret_value = -1;
26
27 if (msg_verbose)
28 msg_info("%s: we will use sizefile = '%s'", myname, filename);
29@@ -136,7 +137,7 @@
30 first = 1;
31
32 while (*p) {
33- long n = 0, c = 0;
34+ int64_t n = 0, c = 0;
35 char *q = p;
36
37 while (*p) {
38@@ -151,7 +152,7 @@
39 continue;
40 }
41
42- if (sscanf(q, "%ld %ld", &n, &c) == 2) {
43+ if (sscanf(q, "%lld %lld", &n, &c) == 2) {
44 sum += n;
45 count += c;
46 /* if (msg_verbose)
47@@ -179,7 +180,7 @@
48 ret_value = -1;
49 } else {
50 if (msg_verbose)
51- msg_info("%s: we will return Maildir size = %ld, count = %ld", myname, *sumptr, *countptr);
52+ msg_info("%s: we will return Maildir size = %lld, count = %lld", myname, *sumptr, *countptr);
53
54 ret_value = sum;
55 }
56@@ -200,7 +201,7 @@
57 * Returns the size given in ",S=<size>" in the filename,
58 * zero if it cannot find ",S=<size>" in the filename.
59 */
60-static long maildir_parsequota(const char *n)
61+static int64_t maildir_parsequota(const char *n)
62 {
63 const char *o;
64 int yes = 0;
65@@ -225,7 +226,7 @@
66 }
67
68 if (yes) {
69- long s = 0;
70+ int64_t s = 0;
71
72 while (*o >= '0' && *o <= '9')
73 s = s*10 + (*o++ - '0');
74@@ -252,11 +253,11 @@
75 * Returns the sum of the sizes of all measurable files,
76 * zero if the directory could not be opened.
77 */
78-static long check_dir_size(char *dirname, long *countptr)
79+static int64_t check_dir_size(char *dirname, int64_t *countptr)
80 {
81 char *myname = "check_dir_size";
82 DIR *dir;
83- long sum = 0;
84+ int64_t sum = 0;
85 struct dirent *ent;
86 struct stat statbuf;
87
88@@ -277,7 +278,7 @@
89
90 while ((ent = readdir(dir)) != NULL) {
91 char *name = ent->d_name;
92- long tmpsum = 0;
93+ int64_t tmpsum = 0;
94 VSTRING *buffer;
95
96 /* do not count dot a double-dot dirs */
97@@ -324,7 +325,7 @@
98 }
99 if ((statbuf.st_mode & S_IFREG) != 0) {
100 if (strcmp(dirname + strlen(dirname) - 3, "new") == 0 || strcmp(dirname + strlen(dirname) - 3, "cur") == 0 || strcmp(dirname + strlen(dirname) - 3, "tmp") == 0) {
101- sum += (long) statbuf.st_size;
102+ sum += (int64_t) statbuf.st_size;
103 (*countptr)++;
104 }
105 }
106@@ -338,7 +339,7 @@
107 closedir(dir);
108
109 if (msg_verbose)
110- msg_info("%s: full scan done: dir=%s sum=%ld count=%ld", myname, dirname, sum, *countptr);
111+ msg_info("%s: full scan done: dir=%s sum=%lld count=%lld", myname, dirname, sum, *countptr);
112
113 return sum;
114 }
115@@ -456,9 +457,9 @@
116 char *sizefilename = (char *) 0; /* Maildirsize file name. */
117 VSTRING *filequota; /* Quota setting from the maildirsize file. */
118 VSTREAM *sizefile; /* Maildirsize file handle. */
119- long n = 0; /* Limit in long integer format. */
120- long saved_count = 0; /* The total number of files. */
121- long saved_size = 0; /* The total quota of all files. */
122+ int64_t n = 0; /* Limit in long integer format. */
123+ int64_t saved_count = 0; /* The total number of files. */
124+ int64_t saved_size = 0; /* The total quota of all files. */
125 struct stat mail_stat; /* To check the size of the mail to be written. */
126 struct stat sizefile_stat; /* To check the size of the maildirsize file. */
127 time_t tm; /* To check the age of the maildirsize file. */
128@@ -541,7 +542,7 @@
129 * warn the user, else use the value directly as the maildir limit.
130 */
131 if (*var_virt_mailbox_limit_maps != 0 && (limit_res = mail_addr_find(virtual_mailbox_limit_maps, state.msg_attr.user, (char **) NULL)) != 0) {
132- n = atol(limit_res);
133+ n = strtoll(limit_res, NULL, 10);
134 if (n > 0) {
135 if ((n < var_message_limit) && (!var_virt_mailbox_limit_override)) {
136 n = var_virt_mailbox_limit;
137@@ -552,13 +553,13 @@
138 }
139 else {
140 if (msg_verbose)
141- msg_info("%s: set virtual maildir limit size for %s to %ld",
142+ msg_info("%s: set virtual maildir limit size for %s to %lld",
143 myname, usr_attr.mailbox, n);
144 }
145 }
146 else if (n == 0) {
147 if (msg_verbose)
148- msg_info("%s: set virtual maildir limit size for %s to %ld",
149+ msg_info("%s: set virtual maildir limit size for %s to %lld",
150 myname, usr_attr.mailbox, n);
151 }
152 else {
153@@ -580,7 +581,7 @@
154 x >= 0 = reading successfully finished - sum si returned, so sum size of Maildir was 0 or more */
155 if (!var_virt_mailbox_limit_inbox && var_virt_maildir_extended && read_maildirsize(sizefilename, &saved_size, &saved_count) >= 0) {
156 if (msg_verbose)
157- msg_info("%s: maildirsize used=%s sum=%ld count=%ld", myname, sizefilename, saved_size, saved_count);
158+ msg_info("%s: maildirsize used=%s sum=%lld count=%lld", myname, sizefilename, saved_size, saved_count);
159 } else {
160 if (msg_verbose)
161 msg_info("%s: var_virt_mailbox_limit == 1 OR var_virt_maildir_extended == 0 OR read_maildidrsize() returned value x < 0 as saying something failed", myname);
162@@ -693,7 +694,7 @@
163 */
164 if (stat(tmpfile, &mail_stat) == 0) {
165 if (n != 0) {
166- saved_size += (long) mail_stat.st_size;
167+ saved_size += (int64_t) mail_stat.st_size;
168 saved_count++;
169 }
170 if (var_virt_maildir_extended) {
171@@ -710,7 +711,7 @@
172 */
173 if (saved_size > n) {
174 mail_copy_status = MAIL_COPY_STAT_WRITE;
175- if (((long) mail_stat.st_size > n) || (var_virt_overquota_bounce))
176+ if (((int64_t) mail_stat.st_size > n) || (var_virt_overquota_bounce))
177 errno = EFBIG;
178 else
179 errno = EDQUOT;
180@@ -889,7 +890,7 @@
181 filequota = vstring_alloc(128);
182 vstring_get_null_bound(filequota, sizefile, 127);
183 vstream_fclose(sizefile);
184- if (atol(vstring_export(filequota)) != n)
185+ if (strtoll(vstring_export(filequota), NULL, 10) != n)
186 unlink(sizefilename);
187 }
188
189@@ -909,13 +910,13 @@
190
191 /* If the creation worked, write to the file, otherwise just give up. */
192 if (sizefile) {
193- vstream_fprintf(sizefile, "%ldS\n%ld %ld\n", n, saved_size, saved_count);
194+ vstream_fprintf(sizefile, "%lldS\n%lld %lld\n", n, saved_size, saved_count);
195 vstream_fclose(sizefile);
196 }
197 }
198 else {
199 /* We opened maildirsize, so let's just append this transaction and close it. */
200- vstream_fprintf(sizefile, "%ld 1\n", (long) mail_stat.st_size);
201+ vstream_fprintf(sizefile, "%lld 1\n", (int64_t) mail_stat.st_size);
202 vstream_fclose(sizefile);
203 }
204
This page took 0.254375 seconds and 5 git commands to generate.