* lib/mu_dbm.c: Add <errno.h>.
Remove trailing spaces.
Showing
3 changed files
with
28 additions
and
23 deletions
1 | 2001-11-11 Alain Magloire | ||
2 | |||
3 | * lib/mu_dbm.c: Add <errno.h>. | ||
4 | Remove trailing spaces. | ||
5 | |||
1 | 2001-11-11 Sergey Poznyakoff | 6 | 2001-11-11 Sergey Poznyakoff |
2 | 7 | ||
3 | * lib/mu_dbm.c: (new) These functions provide an | 8 | * lib/mu_dbm.c: (new) These functions provide an |
... | @@ -17,7 +22,7 @@ | ... | @@ -17,7 +22,7 @@ |
17 | * pop3d/apop.c: Bunch of changes due to introduction of new | 22 | * pop3d/apop.c: Bunch of changes due to introduction of new |
18 | DBM interface. | 23 | DBM interface. |
19 | * pop3d/pop3d.h: Likewise. | 24 | * pop3d/pop3d.h: Likewise. |
20 | 25 | ||
21 | * comsat/Makefile.am: Added comsat.h to sources | 26 | * comsat/Makefile.am: Added comsat.h to sources |
22 | 27 | ||
23 | 2001-11-10 Jeff Bailey <jbailey@outpost.dnsalias.org> | 28 | 2001-11-10 Jeff Bailey <jbailey@outpost.dnsalias.org> |
... | @@ -34,7 +39,7 @@ | ... | @@ -34,7 +39,7 @@ |
34 | * doc/man/pop3d.1: New File | 39 | * doc/man/pop3d.1: New File |
35 | 40 | ||
36 | * doc/man/imap4d.1: New File | 41 | * doc/man/imap4d.1: New File |
37 | 42 | ||
38 | * doc/man/Makefile.am: New File | 43 | * doc/man/Makefile.am: New File |
39 | 44 | ||
40 | * pop3d/pop3d.c: Change timeout to unsigned int from size_t. | 45 | * pop3d/pop3d.c: Change timeout to unsigned int from size_t. | ... | ... |
... | @@ -29,13 +29,14 @@ | ... | @@ -29,13 +29,14 @@ |
29 | #ifdef HAVE_STRINGS_H | 29 | #ifdef HAVE_STRINGS_H |
30 | # include <strings.h> | 30 | # include <strings.h> |
31 | #endif | 31 | #endif |
32 | #include <errno.h> | ||
32 | #include <mu_dbm.h> | 33 | #include <mu_dbm.h> |
33 | 34 | ||
34 | int | 35 | int |
35 | mu_fcheck_perm (int fd, int mode) | 36 | mu_fcheck_perm (int fd, int mode) |
36 | { | 37 | { |
37 | struct stat st; | 38 | struct stat st; |
38 | 39 | ||
39 | if (fstat (fd, &st) == -1) | 40 | if (fstat (fd, &st) == -1) |
40 | { | 41 | { |
41 | if (errno == ENOENT) | 42 | if (errno == ENOENT) |
... | @@ -47,12 +48,12 @@ mu_fcheck_perm (int fd, int mode) | ... | @@ -47,12 +48,12 @@ mu_fcheck_perm (int fd, int mode) |
47 | return 1; | 48 | return 1; |
48 | return 0; | 49 | return 0; |
49 | } | 50 | } |
50 | 51 | ||
51 | int | 52 | int |
52 | mu_check_perm (char *name, int mode) | 53 | mu_check_perm (char *name, int mode) |
53 | { | 54 | { |
54 | struct stat st; | 55 | struct stat st; |
55 | 56 | ||
56 | if (stat (name, &st) == -1) | 57 | if (stat (name, &st) == -1) |
57 | { | 58 | { |
58 | if (errno == ENOENT) | 59 | if (errno == ENOENT) |
... | @@ -74,7 +75,7 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) | ... | @@ -74,7 +75,7 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) |
74 | { | 75 | { |
75 | int f; | 76 | int f; |
76 | char *pfname; | 77 | char *pfname; |
77 | 78 | ||
78 | pfname = xmalloc (strlen (name) + sizeof DB_SUFFIX); | 79 | pfname = xmalloc (strlen (name) + sizeof DB_SUFFIX); |
79 | strcat (strcpy (pfname, name), DB_SUFFIX); | 80 | strcat (strcpy (pfname, name), DB_SUFFIX); |
80 | if (mu_check_perm (pfname, mode)) | 81 | if (mu_check_perm (pfname, mode)) |
... | @@ -82,7 +83,7 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) | ... | @@ -82,7 +83,7 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) |
82 | free (pfname); | 83 | free (pfname); |
83 | return -1; | 84 | return -1; |
84 | } | 85 | } |
85 | 86 | ||
86 | switch (flags) | 87 | switch (flags) |
87 | { | 88 | { |
88 | case MU_STREAM_CREAT: | 89 | case MU_STREAM_CREAT: |
... | @@ -147,7 +148,7 @@ mu_dbm_open(char *name, DBM_FILE *dbm, int flags, int mode) | ... | @@ -147,7 +148,7 @@ mu_dbm_open(char *name, DBM_FILE *dbm, int flags, int mode) |
147 | int f, rc; | 148 | int f, rc; |
148 | DB *db; | 149 | DB *db; |
149 | char *pfname; | 150 | char *pfname; |
150 | 151 | ||
151 | pfname = xmalloc (strlen (name) + sizeof DB_SUFFIX); | 152 | pfname = xmalloc (strlen (name) + sizeof DB_SUFFIX); |
152 | strcat (strcpy (pfname, name), DB_SUFFIX); | 153 | strcat (strcpy (pfname, name), DB_SUFFIX); |
153 | if (mu_check_perm (pfname, mode)) | 154 | if (mu_check_perm (pfname, mode)) |
... | @@ -155,7 +156,7 @@ mu_dbm_open(char *name, DBM_FILE *dbm, int flags, int mode) | ... | @@ -155,7 +156,7 @@ mu_dbm_open(char *name, DBM_FILE *dbm, int flags, int mode) |
155 | free (pfname); | 156 | free (pfname); |
156 | return -1; | 157 | return -1; |
157 | } | 158 | } |
158 | 159 | ||
159 | switch (flags) | 160 | switch (flags) |
160 | { | 161 | { |
161 | case MU_STREAM_CREAT: | 162 | case MU_STREAM_CREAT: |
... | @@ -177,7 +178,7 @@ mu_dbm_open(char *name, DBM_FILE *dbm, int flags, int mode) | ... | @@ -177,7 +178,7 @@ mu_dbm_open(char *name, DBM_FILE *dbm, int flags, int mode) |
177 | free (pfname); | 178 | free (pfname); |
178 | if (rc) | 179 | if (rc) |
179 | return -1; | 180 | return -1; |
180 | 181 | ||
181 | *dbm = malloc (sizeof **dbm); | 182 | *dbm = malloc (sizeof **dbm); |
182 | if (!*dbm) | 183 | if (!*dbm) |
183 | { | 184 | { |
... | @@ -225,14 +226,14 @@ mu_dbm_firstkey (DBM_FILE db) | ... | @@ -225,14 +226,14 @@ mu_dbm_firstkey (DBM_FILE db) |
225 | if (db->db->cursor(db->db, NULL, &db->dbc, 0) != 0) | 226 | if (db->db->cursor(db->db, NULL, &db->dbc, 0) != 0) |
226 | return key; | 227 | return key; |
227 | } | 228 | } |
228 | 229 | ||
229 | if ((ret = db->dbc->c_get(db->dbc, &key, &data, DB_FIRST)) != 0) | 230 | if ((ret = db->dbc->c_get(db->dbc, &key, &data, DB_FIRST)) != 0) |
230 | { | 231 | { |
231 | key.data = NULL; | 232 | key.data = NULL; |
232 | key.size = 0; | 233 | key.size = 0; |
233 | if (ret == DB_NOTFOUND) | 234 | if (ret == DB_NOTFOUND) |
234 | errno = ENOENT; | 235 | errno = ENOENT; |
235 | else | 236 | else |
236 | errno = ret; | 237 | errno = ret; |
237 | } | 238 | } |
238 | return key; | 239 | return key; |
... | @@ -246,17 +247,17 @@ mu_dbm_nextkey (DBM_FILE db, DBM_DATUM pkey /*unused*/) | ... | @@ -246,17 +247,17 @@ mu_dbm_nextkey (DBM_FILE db, DBM_DATUM pkey /*unused*/) |
246 | 247 | ||
247 | memset(&key, 0, sizeof key); | 248 | memset(&key, 0, sizeof key); |
248 | memset(&data, 0, sizeof data); | 249 | memset(&data, 0, sizeof data); |
249 | 250 | ||
250 | if (!db->dbc) | 251 | if (!db->dbc) |
251 | return key; | 252 | return key; |
252 | 253 | ||
253 | if ((ret = db->dbc->c_get(db->dbc, &key, &data, DB_NEXT)) != 0) | 254 | if ((ret = db->dbc->c_get(db->dbc, &key, &data, DB_NEXT)) != 0) |
254 | { | 255 | { |
255 | key.data = NULL; | 256 | key.data = NULL; |
256 | key.size = 0; | 257 | key.size = 0; |
257 | if (ret == DB_NOTFOUND) | 258 | if (ret == DB_NOTFOUND) |
258 | errno = ENOENT; | 259 | errno = ENOENT; |
259 | else | 260 | else |
260 | errno = ret; | 261 | errno = ret; |
261 | } | 262 | } |
262 | return key; | 263 | return key; |
... | @@ -270,7 +271,7 @@ int | ... | @@ -270,7 +271,7 @@ int |
270 | mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) | 271 | mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) |
271 | { | 272 | { |
272 | int f; | 273 | int f; |
273 | 274 | ||
274 | switch (flags) | 275 | switch (flags) |
275 | { | 276 | { |
276 | case MU_STREAM_CREAT: | 277 | case MU_STREAM_CREAT: |
... | @@ -296,7 +297,7 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) | ... | @@ -296,7 +297,7 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) |
296 | dbm_close (*db); | 297 | dbm_close (*db); |
297 | return 1; | 298 | return 1; |
298 | } | 299 | } |
299 | 300 | ||
300 | return 0; | 301 | return 0; |
301 | } | 302 | } |
302 | 303 | ||
... | @@ -339,7 +340,7 @@ int | ... | @@ -339,7 +340,7 @@ int |
339 | mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) | 340 | mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) |
340 | { | 341 | { |
341 | int f; | 342 | int f; |
342 | 343 | ||
343 | switch (flags) | 344 | switch (flags) |
344 | { | 345 | { |
345 | case MU_STREAM_CREAT: | 346 | case MU_STREAM_CREAT: |
... | @@ -359,12 +360,12 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) | ... | @@ -359,12 +360,12 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) |
359 | { | 360 | { |
360 | char *p; | 361 | char *p; |
361 | int fd; | 362 | int fd; |
362 | 363 | ||
363 | p = xmalloc(strlen(name)+5); | 364 | p = xmalloc(strlen(name)+5); |
364 | strcat(strcpy(p, name), ".pag"); | 365 | strcat(strcpy(p, name), ".pag"); |
365 | fd = open(p, f, mode); | 366 | fd = open(p, f, mode); |
366 | free(p); | 367 | free(p); |
367 | if (fd < 0) | 368 | if (fd < 0) |
368 | return -1; | 369 | return -1; |
369 | close(fd); | 370 | close(fd); |
370 | 371 | ||
... | @@ -372,11 +373,11 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) | ... | @@ -372,11 +373,11 @@ mu_dbm_open(char *name, DBM_FILE *db, int flags, int mode) |
372 | strcat(strcpy(p, name), ".dir"); | 373 | strcat(strcpy(p, name), ".dir"); |
373 | fd = open(p, f, mode); | 374 | fd = open(p, f, mode); |
374 | free(p); | 375 | free(p); |
375 | if (fd < 0) | 376 | if (fd < 0) |
376 | return -1; | 377 | return -1; |
377 | close(fd); | 378 | close(fd); |
378 | } | 379 | } |
379 | 380 | ||
380 | return dbminit(name); | 381 | return dbminit(name); |
381 | } | 382 | } |
382 | 383 | ... | ... |
... | @@ -492,7 +492,6 @@ pop_open (mailbox_t mbox, int flags) | ... | @@ -492,7 +492,6 @@ pop_open (mailbox_t mbox, int flags) |
492 | { | 492 | { |
493 | pop_data_t mpd = mbox->data; | 493 | pop_data_t mpd = mbox->data; |
494 | int status; | 494 | int status; |
495 | void *func = (void *)pop_open; | ||
496 | char *host; | 495 | char *host; |
497 | size_t hostlen = 0; | 496 | size_t hostlen = 0; |
498 | long port = 110; | 497 | long port = 110; | ... | ... |
-
Please register or sign in to post a comment