Revise the usage of return codes.
Showing
59 changed files
with
372 additions
and
225 deletions
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -27,6 +27,7 @@ | ... | @@ -27,6 +27,7 @@ |
27 | #include <unistd.h> | 27 | #include <unistd.h> |
28 | #include <mailutils/argp.h> | 28 | #include <mailutils/argp.h> |
29 | #include <mailutils/error.h> | 29 | #include <mailutils/error.h> |
30 | #include <mailutils/errno.h> | ||
30 | #include <mailutils/mu_auth.h> | 31 | #include <mailutils/mu_auth.h> |
31 | #include <mailutils/nls.h> | 32 | #include <mailutils/nls.h> |
32 | #include <mailutils/stream.h> | 33 | #include <mailutils/stream.h> |
... | @@ -288,7 +289,7 @@ gsasl_stream_create (stream_t *stream, int fd, | ... | @@ -288,7 +289,7 @@ gsasl_stream_create (stream_t *stream, int fd, |
288 | int rc; | 289 | int rc; |
289 | 290 | ||
290 | if (stream == NULL) | 291 | if (stream == NULL) |
291 | return EINVAL; | 292 | return MU_ERR_OUT_PTR_NULL; |
292 | 293 | ||
293 | if ((flags & ~(MU_STREAM_READ|MU_STREAM_WRITE)) | 294 | if ((flags & ~(MU_STREAM_READ|MU_STREAM_WRITE)) |
294 | || (flags & (MU_STREAM_READ|MU_STREAM_WRITE)) == | 295 | || (flags & (MU_STREAM_READ|MU_STREAM_WRITE)) == | ... | ... |
... | @@ -32,6 +32,7 @@ | ... | @@ -32,6 +32,7 @@ |
32 | #include <mailutils/tls.h> | 32 | #include <mailutils/tls.h> |
33 | #include <mailutils/nls.h> | 33 | #include <mailutils/nls.h> |
34 | #include <mailutils/stream.h> | 34 | #include <mailutils/stream.h> |
35 | #include <mailutils/errno.h> | ||
35 | 36 | ||
36 | #include <lbuf.h> | 37 | #include <lbuf.h> |
37 | 38 | ||
... | @@ -521,7 +522,7 @@ tls_stream_create (stream_t *stream, int in_fd, int out_fd, int flags) | ... | @@ -521,7 +522,7 @@ tls_stream_create (stream_t *stream, int in_fd, int out_fd, int flags) |
521 | int rc; | 522 | int rc; |
522 | 523 | ||
523 | if (stream == NULL) | 524 | if (stream == NULL) |
524 | return EINVAL; | 525 | return MU_ERR_OUT_PTR_NULL; |
525 | 526 | ||
526 | s = calloc (1, sizeof (*s)); | 527 | s = calloc (1, sizeof (*s)); |
527 | if (s == NULL) | 528 | if (s == NULL) | ... | ... |
... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
23 | #include <mailutils/errno.h> | 23 | #include <mailutils/errno.h> |
24 | #include <mailutils/mutil.h> | 24 | #include <mailutils/mutil.h> |
25 | 25 | ||
26 | #define EPARSE ENOENT | 26 | #define EPARSE MU_ERR_NOENT |
27 | 27 | ||
28 | static int | 28 | static int |
29 | parse (const char *str) | 29 | parse (const char *str) | ... | ... |
... | @@ -170,7 +170,6 @@ char * | ... | @@ -170,7 +170,6 @@ char * |
170 | namespace_checkfullpath (char *name, const char *pattern, const char *delim) | 170 | namespace_checkfullpath (char *name, const char *pattern, const char *delim) |
171 | { | 171 | { |
172 | struct namespace_info info; | 172 | struct namespace_info info; |
173 | url_t url = NULL; | ||
174 | char *p, *path = NULL; | 173 | char *p, *path = NULL; |
175 | char *scheme = NULL; | 174 | char *scheme = NULL; |
176 | 175 | ... | ... |
... | @@ -275,7 +275,7 @@ mu_dbm_firstkey (DBM_FILE db) | ... | @@ -275,7 +275,7 @@ mu_dbm_firstkey (DBM_FILE db) |
275 | key.data = NULL; | 275 | key.data = NULL; |
276 | key.size = 0; | 276 | key.size = 0; |
277 | if (ret == DB_NOTFOUND) | 277 | if (ret == DB_NOTFOUND) |
278 | errno = ENOENT; | 278 | errno = MU_ERR_NOENT; |
279 | else | 279 | else |
280 | errno = ret; | 280 | errno = ret; |
281 | } | 281 | } |
... | @@ -299,7 +299,7 @@ mu_dbm_nextkey (DBM_FILE db, DBM_DATUM pkey /*unused*/) | ... | @@ -299,7 +299,7 @@ mu_dbm_nextkey (DBM_FILE db, DBM_DATUM pkey /*unused*/) |
299 | key.data = NULL; | 299 | key.data = NULL; |
300 | key.size = 0; | 300 | key.size = 0; |
301 | if (ret == DB_NOTFOUND) | 301 | if (ret == DB_NOTFOUND) |
302 | errno = ENOENT; | 302 | errno = MU_ERR_NOENT; |
303 | else | 303 | else |
304 | errno = ret; | 304 | errno = ret; |
305 | } | 305 | } | ... | ... |
... | @@ -1269,7 +1269,7 @@ util_get_message (mailbox_t mbox, size_t msgno, message_t *msg) | ... | @@ -1269,7 +1269,7 @@ util_get_message (mailbox_t mbox, size_t msgno, message_t *msg) |
1269 | if (msgno > total) | 1269 | if (msgno > total) |
1270 | { | 1270 | { |
1271 | util_error_range (msgno); | 1271 | util_error_range (msgno); |
1272 | return ENOENT; | 1272 | return MU_ERR_NOENT; |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | status = mailbox_get_message (mbox, msgno, msg); | 1275 | status = mailbox_get_message (mbox, msgno, msg); | ... | ... |
... | @@ -206,7 +206,7 @@ address_get_nth (address_t addr, size_t no, address_t *pret) | ... | @@ -206,7 +206,7 @@ address_get_nth (address_t addr, size_t no, address_t *pret) |
206 | { | 206 | { |
207 | address_t subaddr = _address_get_nth (addr, no); | 207 | address_t subaddr = _address_get_nth (addr, no); |
208 | if (!subaddr) | 208 | if (!subaddr) |
209 | return ENOENT; | 209 | return MU_ERR_NOENT; |
210 | *pret = address_dup (subaddr); | 210 | *pret = address_dup (subaddr); |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
... | @@ -223,7 +223,7 @@ address_get_personal (address_t addr, size_t no, char *buf, size_t len, | ... | @@ -223,7 +223,7 @@ address_get_personal (address_t addr, size_t no, char *buf, size_t len, |
223 | 223 | ||
224 | subaddr = _address_get_nth (addr, no); | 224 | subaddr = _address_get_nth (addr, no); |
225 | if (!subaddr) | 225 | if (!subaddr) |
226 | return ENOENT; | 226 | return MU_ERR_NOENT; |
227 | 227 | ||
228 | i = mu_cpystr (buf, subaddr->personal, len); | 228 | i = mu_cpystr (buf, subaddr->personal, len); |
229 | if (n) | 229 | if (n) |
... | @@ -243,7 +243,7 @@ address_get_comments (address_t addr, size_t no, char *buf, size_t len, | ... | @@ -243,7 +243,7 @@ address_get_comments (address_t addr, size_t no, char *buf, size_t len, |
243 | 243 | ||
244 | subaddr = _address_get_nth (addr, no); | 244 | subaddr = _address_get_nth (addr, no); |
245 | if (!subaddr) | 245 | if (!subaddr) |
246 | return ENOENT; | 246 | return MU_ERR_NOENT; |
247 | 247 | ||
248 | i = mu_cpystr (buf, subaddr->comments, len); | 248 | i = mu_cpystr (buf, subaddr->comments, len); |
249 | if (n) | 249 | if (n) |
... | @@ -263,7 +263,7 @@ address_get_email (address_t addr, size_t no, char *buf, size_t len, | ... | @@ -263,7 +263,7 @@ address_get_email (address_t addr, size_t no, char *buf, size_t len, |
263 | 263 | ||
264 | subaddr = _address_get_nth (addr, no); | 264 | subaddr = _address_get_nth (addr, no); |
265 | if (!subaddr) | 265 | if (!subaddr) |
266 | return ENOENT; | 266 | return MU_ERR_NOENT; |
267 | 267 | ||
268 | i = mu_cpystr (buf, subaddr->email, len); | 268 | i = mu_cpystr (buf, subaddr->email, len); |
269 | if (n) | 269 | if (n) |
... | @@ -348,7 +348,7 @@ address_aget_personal (address_t addr, size_t no, char **buf) | ... | @@ -348,7 +348,7 @@ address_aget_personal (address_t addr, size_t no, char **buf) |
348 | 348 | ||
349 | subaddr = _address_get_nth (addr, no); | 349 | subaddr = _address_get_nth (addr, no); |
350 | if (!subaddr) | 350 | if (!subaddr) |
351 | return ENOENT; | 351 | return MU_ERR_NOENT; |
352 | 352 | ||
353 | if (subaddr->personal) | 353 | if (subaddr->personal) |
354 | { | 354 | { |
... | @@ -372,7 +372,7 @@ address_aget_comments (address_t addr, size_t no, char **buf) | ... | @@ -372,7 +372,7 @@ address_aget_comments (address_t addr, size_t no, char **buf) |
372 | 372 | ||
373 | subaddr = _address_get_nth (addr, no); | 373 | subaddr = _address_get_nth (addr, no); |
374 | if (!subaddr) | 374 | if (!subaddr) |
375 | return ENOENT; | 375 | return MU_ERR_NOENT; |
376 | 376 | ||
377 | if (subaddr->comments) | 377 | if (subaddr->comments) |
378 | { | 378 | { |
... | @@ -396,7 +396,7 @@ address_aget_email (address_t addr, size_t no, char **buf) | ... | @@ -396,7 +396,7 @@ address_aget_email (address_t addr, size_t no, char **buf) |
396 | 396 | ||
397 | subaddr = _address_get_nth (addr, no); | 397 | subaddr = _address_get_nth (addr, no); |
398 | if (!subaddr) | 398 | if (!subaddr) |
399 | return ENOENT; | 399 | return MU_ERR_NOENT; |
400 | 400 | ||
401 | if (subaddr->email) | 401 | if (subaddr->email) |
402 | { | 402 | { |
... | @@ -421,7 +421,7 @@ address_aget_local_part (address_t addr, size_t no, char **buf) | ... | @@ -421,7 +421,7 @@ address_aget_local_part (address_t addr, size_t no, char **buf) |
421 | 421 | ||
422 | subaddr = _address_get_nth (addr, no); | 422 | subaddr = _address_get_nth (addr, no); |
423 | if (!subaddr) | 423 | if (!subaddr) |
424 | return ENOENT; | 424 | return MU_ERR_NOENT; |
425 | 425 | ||
426 | if (subaddr->local_part) | 426 | if (subaddr->local_part) |
427 | { | 427 | { |
... | @@ -446,7 +446,7 @@ address_aget_domain (address_t addr, size_t no, char **buf) | ... | @@ -446,7 +446,7 @@ address_aget_domain (address_t addr, size_t no, char **buf) |
446 | 446 | ||
447 | subaddr = _address_get_nth (addr, no); | 447 | subaddr = _address_get_nth (addr, no); |
448 | if (!subaddr) | 448 | if (!subaddr) |
449 | return ENOENT; | 449 | return MU_ERR_NOENT; |
450 | 450 | ||
451 | if (subaddr->domain) | 451 | if (subaddr->domain) |
452 | { | 452 | { |
... | @@ -472,7 +472,7 @@ address_get_local_part (address_t addr, size_t no, char *buf, size_t len, | ... | @@ -472,7 +472,7 @@ address_get_local_part (address_t addr, size_t no, char *buf, size_t len, |
472 | 472 | ||
473 | subaddr = _address_get_nth (addr, no); | 473 | subaddr = _address_get_nth (addr, no); |
474 | if (!subaddr) | 474 | if (!subaddr) |
475 | return ENOENT; | 475 | return MU_ERR_NOENT; |
476 | 476 | ||
477 | i = mu_cpystr (buf, subaddr->local_part, len); | 477 | i = mu_cpystr (buf, subaddr->local_part, len); |
478 | if (n) | 478 | if (n) |
... | @@ -492,7 +492,7 @@ address_get_domain (address_t addr, size_t no, char *buf, size_t len, | ... | @@ -492,7 +492,7 @@ address_get_domain (address_t addr, size_t no, char *buf, size_t len, |
492 | 492 | ||
493 | subaddr = _address_get_nth (addr, no); | 493 | subaddr = _address_get_nth (addr, no); |
494 | if (!subaddr) | 494 | if (!subaddr) |
495 | return ENOENT; | 495 | return MU_ERR_NOENT; |
496 | 496 | ||
497 | i = mu_cpystr (buf, subaddr->domain, len); | 497 | i = mu_cpystr (buf, subaddr->domain, len); |
498 | if (n) | 498 | if (n) |
... | @@ -512,7 +512,7 @@ address_get_route (address_t addr, size_t no, char *buf, size_t len, | ... | @@ -512,7 +512,7 @@ address_get_route (address_t addr, size_t no, char *buf, size_t len, |
512 | 512 | ||
513 | subaddr = _address_get_nth (addr, no); | 513 | subaddr = _address_get_nth (addr, no); |
514 | if (!subaddr) | 514 | if (!subaddr) |
515 | return ENOENT; | 515 | return MU_ERR_NOENT; |
516 | 516 | ||
517 | i = mu_cpystr (buf, subaddr->route, len); | 517 | i = mu_cpystr (buf, subaddr->route, len); |
518 | if (n) | 518 | if (n) |
... | @@ -554,7 +554,7 @@ address_is_group (address_t addr, size_t no, int *yes) | ... | @@ -554,7 +554,7 @@ address_is_group (address_t addr, size_t no, int *yes) |
554 | 554 | ||
555 | subaddr = _address_get_nth (addr, no); | 555 | subaddr = _address_get_nth (addr, no); |
556 | if (!subaddr) | 556 | if (!subaddr) |
557 | return ENOENT; | 557 | return MU_ERR_NOENT; |
558 | 558 | ||
559 | if (yes) | 559 | if (yes) |
560 | *yes = _address_is_group (subaddr); | 560 | *yes = _address_is_group (subaddr); | ... | ... |
... | @@ -55,6 +55,7 @@ | ... | @@ -55,6 +55,7 @@ |
55 | #include <mailutils/debug.h> | 55 | #include <mailutils/debug.h> |
56 | #include <mailutils/envelope.h> | 56 | #include <mailutils/envelope.h> |
57 | #include <mailutils/error.h> | 57 | #include <mailutils/error.h> |
58 | #include <mailutils/errno.h> | ||
58 | #include <mailutils/header.h> | 59 | #include <mailutils/header.h> |
59 | #include <mailutils/locker.h> | 60 | #include <mailutils/locker.h> |
60 | #include <mailutils/message.h> | 61 | #include <mailutils/message.h> |
... | @@ -244,7 +245,9 @@ amd_init_mailbox (mailbox_t mailbox, size_t amd_size, struct _amd_data **pamd) | ... | @@ -244,7 +245,9 @@ amd_init_mailbox (mailbox_t mailbox, size_t amd_size, struct _amd_data **pamd) |
244 | struct _amd_data *amd; | 245 | struct _amd_data *amd; |
245 | size_t name_len; | 246 | size_t name_len; |
246 | 247 | ||
247 | if (mailbox == NULL || amd_size < sizeof (*amd)) | 248 | if (mailbox == NULL) |
249 | return MU_ERR_MBX_NULL; | ||
250 | if (amd_size < sizeof (*amd)) | ||
248 | return EINVAL; | 251 | return EINVAL; |
249 | 252 | ||
250 | amd = mailbox->data = calloc (1, amd_size); | 253 | amd = mailbox->data = calloc (1, amd_size); |
... | @@ -338,7 +341,7 @@ static int | ... | @@ -338,7 +341,7 @@ static int |
338 | amd_close (mailbox_t mailbox) | 341 | amd_close (mailbox_t mailbox) |
339 | { | 342 | { |
340 | if (!mailbox) | 343 | if (!mailbox) |
341 | return EINVAL; | 344 | return MU_ERR_MBX_NULL; |
342 | return 0; | 345 | return 0; |
343 | } | 346 | } |
344 | 347 | ||
... | @@ -463,7 +466,9 @@ amd_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg) | ... | @@ -463,7 +466,9 @@ amd_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg) |
463 | struct _amd_message *mhm; | 466 | struct _amd_message *mhm; |
464 | 467 | ||
465 | /* Sanity checks. */ | 468 | /* Sanity checks. */ |
466 | if (pmsg == NULL || amd == NULL) | 469 | if (pmsg == NULL) |
470 | return MU_ERR_OUT_PTR_NULL; | ||
471 | if (amd == NULL) | ||
467 | return EINVAL; | 472 | return EINVAL; |
468 | 473 | ||
469 | /* If we did not start a scanning yet do it now. */ | 474 | /* If we did not start a scanning yet do it now. */ |
... | @@ -642,7 +647,9 @@ amd_append_message (mailbox_t mailbox, message_t msg) | ... | @@ -642,7 +647,9 @@ amd_append_message (mailbox_t mailbox, message_t msg) |
642 | struct _amd_data *amd = mailbox->data; | 647 | struct _amd_data *amd = mailbox->data; |
643 | struct _amd_message *mhm; | 648 | struct _amd_message *mhm; |
644 | 649 | ||
645 | if (!mailbox || !msg) | 650 | if (!mailbox) |
651 | return MU_ERR_MBX_NULL; | ||
652 | if (!msg) | ||
646 | return EINVAL; | 653 | return EINVAL; |
647 | 654 | ||
648 | mhm = calloc (1, amd->msg_size); | 655 | mhm = calloc (1, amd->msg_size); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -43,6 +43,7 @@ | ... | @@ -43,6 +43,7 @@ |
43 | #include <mailutils/header.h> | 43 | #include <mailutils/header.h> |
44 | #include <mailutils/message.h> | 44 | #include <mailutils/message.h> |
45 | #include <mailutils/stream.h> | 45 | #include <mailutils/stream.h> |
46 | #include <mailutils/errno.h> | ||
46 | 47 | ||
47 | #define MAX_HDR_LEN 256 | 48 | #define MAX_HDR_LEN 256 |
48 | #define BUF_SIZE 2048 | 49 | #define BUF_SIZE 2048 |
... | @@ -74,7 +75,9 @@ message_create_attachment (const char *content_type, const char *encoding, | ... | @@ -74,7 +75,9 @@ message_create_attachment (const char *content_type, const char *encoding, |
74 | char *header, *name = NULL, *fname = NULL; | 75 | char *header, *name = NULL, *fname = NULL; |
75 | int ret; | 76 | int ret; |
76 | 77 | ||
77 | if (filename == NULL || newmsg == NULL) | 78 | if (newmsg == NULL) |
79 | return MU_ERR_OUT_PTR_NULL; | ||
80 | if (filename == NULL) | ||
78 | return EINVAL; | 81 | return EINVAL; |
79 | 82 | ||
80 | if ((ret = message_create (newmsg, NULL)) == 0) | 83 | if ((ret = message_create (newmsg, NULL)) == 0) |
... | @@ -266,7 +269,7 @@ message_get_attachment_name (message_t msg, char *name, size_t bufsz, size_t *sz | ... | @@ -266,7 +269,7 @@ message_get_attachment_name (message_t msg, char *name, size_t bufsz, size_t *sz |
266 | ret = ENOMEM; | 269 | ret = ENOMEM; |
267 | } | 270 | } |
268 | else | 271 | else |
269 | ret = ENOENT; | 272 | ret = MU_ERR_NOENT; |
270 | } | 273 | } |
271 | return ret; | 274 | return ret; |
272 | } | 275 | } |
... | @@ -277,8 +280,8 @@ int message_aget_attachment_name(message_t msg, char** name) | ... | @@ -277,8 +280,8 @@ int message_aget_attachment_name(message_t msg, char** name) |
277 | size_t sz = 0; | 280 | size_t sz = 0; |
278 | int ret = 0; | 281 | int ret = 0; |
279 | 282 | ||
280 | if(name == NULL) | 283 | if (name == NULL) |
281 | return EINVAL; | 284 | return MU_ERR_OUT_PTR_NULL; |
282 | 285 | ||
283 | if((ret = message_get_attachment_name(msg, NULL, 0, &sz)) != 0) | 286 | if((ret = message_get_attachment_name(msg, NULL, 0, &sz)) != 0) |
284 | return ret; | 287 | return ret; |
... | @@ -313,7 +316,7 @@ message_get_attachment_name (message_t msg, char *buf, size_t bufsz, size_t *sz) | ... | @@ -313,7 +316,7 @@ message_get_attachment_name (message_t msg, char *buf, size_t bufsz, size_t *sz) |
313 | 316 | ||
314 | /* If the header wasn't there, we'll fall back to Content-Type, but | 317 | /* If the header wasn't there, we'll fall back to Content-Type, but |
315 | other errors are fatal. */ | 318 | other errors are fatal. */ |
316 | if(ret != 0 && ret != ENOENT) | 319 | if(ret != 0 && ret != MU_ERR_NOENT) |
317 | return ret; | 320 | return ret; |
318 | 321 | ||
319 | if(ret == 0 && value != NULL) | 322 | if(ret == 0 && value != NULL) |
... | @@ -350,7 +353,7 @@ message_get_attachment_name (message_t msg, char *buf, size_t bufsz, size_t *sz) | ... | @@ -350,7 +353,7 @@ message_get_attachment_name (message_t msg, char *buf, size_t bufsz, size_t *sz) |
350 | strncpy(buf, name, bufsz); | 353 | strncpy(buf, name, bufsz); |
351 | } | 354 | } |
352 | else | 355 | else |
353 | ret = ENOENT; | 356 | ret = MU_ERR_NOENT; |
354 | 357 | ||
355 | return ret; | 358 | return ret; |
356 | } | 359 | } |
... | @@ -456,8 +459,10 @@ message_encapsulate (message_t msg, message_t * newmsg, void **data) | ... | @@ -456,8 +459,10 @@ message_encapsulate (message_t msg, message_t * newmsg, void **data) |
456 | size_t nbytes; | 459 | size_t nbytes; |
457 | body_t body; | 460 | body_t body; |
458 | 461 | ||
459 | if (msg == NULL || newmsg == NULL) | 462 | if (msg == NULL) |
460 | return EINVAL; | 463 | return EINVAL; |
464 | if (newmsg == NULL) | ||
465 | return MU_ERR_OUT_PTR_NULL; | ||
461 | 466 | ||
462 | if ((ret = _attachment_setup (&info, msg, &ostream, data)) != 0) | 467 | if ((ret = _attachment_setup (&info, msg, &ostream, data)) != 0) |
463 | return ret; | 468 | return ret; |
... | @@ -514,8 +519,10 @@ message_unencapsulate (message_t msg, message_t * newmsg, void **data) | ... | @@ -514,8 +519,10 @@ message_unencapsulate (message_t msg, message_t * newmsg, void **data) |
514 | stream_t istream, ostream; | 519 | stream_t istream, ostream; |
515 | struct _msg_info *info = NULL; | 520 | struct _msg_info *info = NULL; |
516 | 521 | ||
517 | if (msg == NULL || newmsg == NULL) | 522 | if (msg == NULL) |
518 | return EINVAL; | 523 | return EINVAL; |
524 | if (newmsg == NULL) | ||
525 | return MU_ERR_OUT_PTR_NULL; | ||
519 | 526 | ||
520 | if ((data == NULL || *data == NULL) | 527 | if ((data == NULL || *data == NULL) |
521 | && (ret = message_get_header (msg, &hdr)) == 0) | 528 | && (ret = message_get_header (msg, &hdr)) == 0) | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -28,6 +28,7 @@ | ... | @@ -28,6 +28,7 @@ |
28 | # include <strings.h> | 28 | # include <strings.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #include <mailutils/errno.h> | ||
31 | #include <attribute0.h> | 32 | #include <attribute0.h> |
32 | 33 | ||
33 | static int flags_to_string __P ((int, char *, size_t, size_t *)); | 34 | static int flags_to_string __P ((int, char *, size_t, size_t *)); |
... | @@ -37,7 +38,7 @@ attribute_create (attribute_t *pattr, void *owner) | ... | @@ -37,7 +38,7 @@ attribute_create (attribute_t *pattr, void *owner) |
37 | { | 38 | { |
38 | attribute_t attr; | 39 | attribute_t attr; |
39 | if (pattr == NULL) | 40 | if (pattr == NULL) |
40 | return EINVAL; | 41 | return MU_ERR_OUT_PTR_NULL; |
41 | attr = calloc (1, sizeof(*attr)); | 42 | attr = calloc (1, sizeof(*attr)); |
42 | if (attr == NULL) | 43 | if (attr == NULL) |
43 | return ENOMEM; | 44 | return ENOMEM; |
... | @@ -90,8 +91,10 @@ attribute_set_modified (attribute_t attr) | ... | @@ -90,8 +91,10 @@ attribute_set_modified (attribute_t attr) |
90 | int | 91 | int |
91 | attribute_get_flags (attribute_t attr, int *pflags) | 92 | attribute_get_flags (attribute_t attr, int *pflags) |
92 | { | 93 | { |
93 | if (attr == NULL || pflags == NULL) | 94 | if (attr == NULL) |
94 | return EINVAL; | 95 | return EINVAL; |
96 | if (pflags == NULL) | ||
97 | return MU_ERR_OUT_PTR_NULL; | ||
95 | if (attr->_get_flags) | 98 | if (attr->_get_flags) |
96 | return attr->_get_flags (attr, pflags); | 99 | return attr->_get_flags (attr, pflags); |
97 | *pflags = attr->flags; | 100 | *pflags = attr->flags; | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -48,7 +48,7 @@ authority_create (authority_t *pauthority, ticket_t ticket, void *owner) | ... | @@ -48,7 +48,7 @@ authority_create (authority_t *pauthority, ticket_t ticket, void *owner) |
48 | { | 48 | { |
49 | authority_t authority; | 49 | authority_t authority; |
50 | if (pauthority == NULL) | 50 | if (pauthority == NULL) |
51 | return EINVAL; | 51 | return MU_ERR_OUT_PTR_NULL; |
52 | authority = calloc (1, sizeof (*authority)); | 52 | authority = calloc (1, sizeof (*authority)); |
53 | if (authority == NULL) | 53 | if (authority == NULL) |
54 | return ENOMEM; | 54 | return ENOMEM; |
... | @@ -93,8 +93,10 @@ authority_set_ticket (authority_t authority, ticket_t ticket) | ... | @@ -93,8 +93,10 @@ authority_set_ticket (authority_t authority, ticket_t ticket) |
93 | int | 93 | int |
94 | authority_get_ticket (authority_t authority, ticket_t *pticket) | 94 | authority_get_ticket (authority_t authority, ticket_t *pticket) |
95 | { | 95 | { |
96 | if (authority == NULL || pticket == NULL) | 96 | if (authority == NULL) |
97 | return EINVAL; | 97 | return EINVAL; |
98 | if (pticket == NULL) | ||
99 | return MU_ERR_OUT_PTR_NULL; | ||
98 | if (authority->ticket == NULL) | 100 | if (authority->ticket == NULL) |
99 | { | 101 | { |
100 | int status = ticket_create (&(authority->ticket), authority); | 102 | int status = ticket_create (&(authority->ticket), authority); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
30 | 30 | ||
31 | #include <mailutils/stream.h> | 31 | #include <mailutils/stream.h> |
32 | #include <mailutils/mutil.h> | 32 | #include <mailutils/mutil.h> |
33 | #include <mailutils/errno.h> | ||
33 | #include <body0.h> | 34 | #include <body0.h> |
34 | 35 | ||
35 | #define BODY_MODIFIED 0x10000 | 36 | #define BODY_MODIFIED 0x10000 |
... | @@ -53,7 +54,9 @@ body_create (body_t *pbody, void *owner) | ... | @@ -53,7 +54,9 @@ body_create (body_t *pbody, void *owner) |
53 | { | 54 | { |
54 | body_t body; | 55 | body_t body; |
55 | 56 | ||
56 | if (pbody == NULL || owner == NULL) | 57 | if (pbody == NULL) |
58 | return MU_ERR_OUT_PTR_NULL; | ||
59 | if (owner == NULL) | ||
57 | return EINVAL; | 60 | return EINVAL; |
58 | 61 | ||
59 | body = calloc (1, sizeof (*body)); | 62 | body = calloc (1, sizeof (*body)); |
... | @@ -140,8 +143,10 @@ body_get_filename (body_t body, char *filename, size_t len, size_t *pn) | ... | @@ -140,8 +143,10 @@ body_get_filename (body_t body, char *filename, size_t len, size_t *pn) |
140 | int | 143 | int |
141 | body_get_stream (body_t body, stream_t *pstream) | 144 | body_get_stream (body_t body, stream_t *pstream) |
142 | { | 145 | { |
143 | if (body == NULL || pstream == NULL) | 146 | if (body == NULL) |
144 | return EINVAL; | 147 | return EINVAL; |
148 | if (pstream == NULL) | ||
149 | return MU_ERR_OUT_PTR_NULL; | ||
145 | 150 | ||
146 | if (body->stream == NULL) | 151 | if (body->stream == NULL) |
147 | { | 152 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <string.h> | 25 | #include <string.h> |
26 | 26 | ||
27 | #include <mailutils/errno.h> | ||
27 | #include <debug0.h> | 28 | #include <debug0.h> |
28 | 29 | ||
29 | int | 30 | int |
... | @@ -31,7 +32,7 @@ mu_debug_create (mu_debug_t *pdebug, void *owner) | ... | @@ -31,7 +32,7 @@ mu_debug_create (mu_debug_t *pdebug, void *owner) |
31 | { | 32 | { |
32 | mu_debug_t debug; | 33 | mu_debug_t debug; |
33 | if (pdebug == NULL) | 34 | if (pdebug == NULL) |
34 | return EINVAL; | 35 | return MU_ERR_OUT_PTR_NULL; |
35 | debug = calloc (sizeof (*debug), 1); | 36 | debug = calloc (sizeof (*debug), 1); |
36 | if (debug == NULL) | 37 | if (debug == NULL) |
37 | return ENOMEM; | 38 | return ENOMEM; | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -20,6 +20,7 @@ | ... | @@ -20,6 +20,7 @@ |
20 | #endif | 20 | #endif |
21 | #include <errno.h> | 21 | #include <errno.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <mailutils/errno.h> | ||
23 | #include <envelope0.h> | 24 | #include <envelope0.h> |
24 | 25 | ||
25 | int | 26 | int |
... | @@ -27,7 +28,7 @@ envelope_create (envelope_t *penvelope, void *owner) | ... | @@ -27,7 +28,7 @@ envelope_create (envelope_t *penvelope, void *owner) |
27 | { | 28 | { |
28 | envelope_t envelope; | 29 | envelope_t envelope; |
29 | if (penvelope == NULL) | 30 | if (penvelope == NULL) |
30 | return EINVAL; | 31 | return MU_ERR_OUT_PTR_NULL; |
31 | envelope = calloc (1, sizeof (*envelope)); | 32 | envelope = calloc (1, sizeof (*envelope)); |
32 | if (envelope == NULL) | 33 | if (envelope == NULL) |
33 | return ENOMEM; | 34 | return ENOMEM; | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -486,7 +486,7 @@ file_stream_create (stream_t *stream, const char* filename, int flags) | ... | @@ -486,7 +486,7 @@ file_stream_create (stream_t *stream, const char* filename, int flags) |
486 | int ret; | 486 | int ret; |
487 | 487 | ||
488 | if (stream == NULL) | 488 | if (stream == NULL) |
489 | return EINVAL; | 489 | return MU_ERR_OUT_PTR_NULL; |
490 | 490 | ||
491 | fs = calloc (1, sizeof (struct _file_stream)); | 491 | fs = calloc (1, sizeof (struct _file_stream)); |
492 | if (fs == NULL) | 492 | if (fs == NULL) |
... | @@ -528,7 +528,7 @@ stdio_stream_create (stream_t *stream, FILE *file, int flags) | ... | @@ -528,7 +528,7 @@ stdio_stream_create (stream_t *stream, FILE *file, int flags) |
528 | int ret; | 528 | int ret; |
529 | 529 | ||
530 | if (stream == NULL) | 530 | if (stream == NULL) |
531 | return EINVAL; | 531 | return MU_ERR_OUT_PTR_NULL; |
532 | 532 | ||
533 | if (file == NULL) | 533 | if (file == NULL) |
534 | return EINVAL; | 534 | return EINVAL; |
... | @@ -954,7 +954,7 @@ _prog_stream_create (struct _prog_stream **pfs, | ... | @@ -954,7 +954,7 @@ _prog_stream_create (struct _prog_stream **pfs, |
954 | int ret; | 954 | int ret; |
955 | 955 | ||
956 | if (stream == NULL) | 956 | if (stream == NULL) |
957 | return EINVAL; | 957 | return MU_ERR_OUT_PTR_NULL; |
958 | 958 | ||
959 | if (progname == NULL || (flags & MU_STREAM_NO_CLOSE)) | 959 | if (progname == NULL || (flags & MU_STREAM_NO_CLOSE)) |
960 | return EINVAL; | 960 | return EINVAL; | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -36,6 +36,7 @@ First draft: Alain Magloire. | ... | @@ -36,6 +36,7 @@ First draft: Alain Magloire. |
36 | 36 | ||
37 | #include <mailutils/iterator.h> | 37 | #include <mailutils/iterator.h> |
38 | #include <mailutils/stream.h> | 38 | #include <mailutils/stream.h> |
39 | #include <mailutils/errno.h> | ||
39 | 40 | ||
40 | static void | 41 | static void |
41 | filter_destroy (stream_t stream) | 42 | filter_destroy (stream_t stream) |
... | @@ -138,7 +139,7 @@ int | ... | @@ -138,7 +139,7 @@ int |
138 | filter_get_list (list_t *plist) | 139 | filter_get_list (list_t *plist) |
139 | { | 140 | { |
140 | if (plist == NULL) | 141 | if (plist == NULL) |
141 | return EINVAL; | 142 | return MU_ERR_OUT_PTR_NULL; |
142 | monitor_wrlock (&filter_monitor); | 143 | monitor_wrlock (&filter_monitor); |
143 | if (filter_list == NULL) | 144 | if (filter_list == NULL) |
144 | { | 145 | { |
... | @@ -171,7 +172,9 @@ filter_create (stream_t *pstream, stream_t stream, const char *name, | ... | @@ -171,7 +172,9 @@ filter_create (stream_t *pstream, stream_t stream, const char *name, |
171 | int status; | 172 | int status; |
172 | list_t list = NULL; | 173 | list_t list = NULL; |
173 | 174 | ||
174 | if (pstream == NULL || stream == NULL || name == NULL) | 175 | if (pstream == NULL) |
176 | return MU_ERR_OUT_PTR_NULL; | ||
177 | if (stream == NULL || name == NULL) | ||
175 | return EINVAL; | 178 | return EINVAL; |
176 | 179 | ||
177 | filter_get_list (&list); | 180 | filter_get_list (&list); |
... | @@ -256,6 +259,6 @@ filter_create (stream_t *pstream, stream_t stream, const char *name, | ... | @@ -256,6 +259,6 @@ filter_create (stream_t *pstream, stream_t stream, const char *name, |
256 | stream_set_destroy (*pstream, filter_destroy, filter); | 259 | stream_set_destroy (*pstream, filter_destroy, filter); |
257 | } | 260 | } |
258 | else | 261 | else |
259 | status = ENOENT; | 262 | status = MU_ERR_NOENT; |
260 | return status; | 263 | return status; |
261 | } | 264 | } | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -29,6 +29,7 @@ First Draft: Dave Inglis. | ... | @@ -29,6 +29,7 @@ First Draft: Dave Inglis. |
29 | #include <string.h> | 29 | #include <string.h> |
30 | 30 | ||
31 | #include <mailutils/stream.h> | 31 | #include <mailutils/stream.h> |
32 | #include <mailutils/errno.h> | ||
32 | 33 | ||
33 | #include <filter0.h> | 34 | #include <filter0.h> |
34 | 35 | ||
... | @@ -76,7 +77,9 @@ trans_read (filter_t filter, char *optr, size_t osize, off_t offset, | ... | @@ -76,7 +77,9 @@ trans_read (filter_t filter, char *optr, size_t osize, off_t offset, |
76 | int ret = 0, i; | 77 | int ret = 0, i; |
77 | size_t bytes, *nbytes = &bytes; | 78 | size_t bytes, *nbytes = &bytes; |
78 | 79 | ||
79 | if (optr == NULL || osize == 0) | 80 | if (optr == NULL) |
81 | return MU_ERR_OUT_NULL; | ||
82 | if (osize == 0) | ||
80 | return EINVAL; | 83 | return EINVAL; |
81 | 84 | ||
82 | if (n_bytes) | 85 | if (n_bytes) | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -32,6 +32,7 @@ | ... | @@ -32,6 +32,7 @@ |
32 | #include <mailutils/registrar.h> | 32 | #include <mailutils/registrar.h> |
33 | #include <mailutils/stream.h> | 33 | #include <mailutils/stream.h> |
34 | #include <mailutils/url.h> | 34 | #include <mailutils/url.h> |
35 | #include <mailutils/errno.h> | ||
35 | 36 | ||
36 | #include <folder0.h> | 37 | #include <folder0.h> |
37 | 38 | ||
... | @@ -61,7 +62,7 @@ folder_create (folder_t *pfolder, const char *name) | ... | @@ -61,7 +62,7 @@ folder_create (folder_t *pfolder, const char *name) |
61 | int found = 0; | 62 | int found = 0; |
62 | 63 | ||
63 | if (pfolder == NULL) | 64 | if (pfolder == NULL) |
64 | return EINVAL; | 65 | return MU_ERR_OUT_PTR_NULL; |
65 | 66 | ||
66 | /* Look in the registrar list(iterator), for a possible concrete mailbox | 67 | /* Look in the registrar list(iterator), for a possible concrete mailbox |
67 | implementatio that could match the URL. */ | 68 | implementatio that could match the URL. */ |
... | @@ -147,7 +148,7 @@ folder_create (folder_t *pfolder, const char *name) | ... | @@ -147,7 +148,7 @@ folder_create (folder_t *pfolder, const char *name) |
147 | } | 148 | } |
148 | } | 149 | } |
149 | else | 150 | else |
150 | status = ENOENT; | 151 | status = MU_ERR_NOENT; |
151 | 152 | ||
152 | return status; | 153 | return status; |
153 | } | 154 | } |
... | @@ -239,8 +240,10 @@ folder_set_stream (folder_t folder, stream_t stream) | ... | @@ -239,8 +240,10 @@ folder_set_stream (folder_t folder, stream_t stream) |
239 | int | 240 | int |
240 | folder_get_stream (folder_t folder, stream_t *pstream) | 241 | folder_get_stream (folder_t folder, stream_t *pstream) |
241 | { | 242 | { |
242 | if (folder == NULL || pstream == NULL) | 243 | if (folder == NULL) |
243 | return EINVAL; | 244 | return EINVAL; |
245 | if (pstream == NULL) | ||
246 | return MU_ERR_OUT_PTR_NULL; | ||
244 | *pstream = folder->stream; | 247 | *pstream = folder->stream; |
245 | return 0; | 248 | return 0; |
246 | } | 249 | } |
... | @@ -259,8 +262,10 @@ folder_set_authority (folder_t folder, authority_t authority) | ... | @@ -259,8 +262,10 @@ folder_set_authority (folder_t folder, authority_t authority) |
259 | int | 262 | int |
260 | folder_get_authority (folder_t folder, authority_t *pauthority) | 263 | folder_get_authority (folder_t folder, authority_t *pauthority) |
261 | { | 264 | { |
262 | if (folder == NULL || pauthority == NULL) | 265 | if (folder == NULL) |
263 | return EINVAL; | 266 | return EINVAL; |
267 | if (pauthority == NULL) | ||
268 | return MU_ERR_OUT_PTR_NULL; | ||
264 | *pauthority = folder->authority; | 269 | *pauthority = folder->authority; |
265 | return 0; | 270 | return 0; |
266 | } | 271 | } |
... | @@ -268,8 +273,10 @@ folder_get_authority (folder_t folder, authority_t *pauthority) | ... | @@ -268,8 +273,10 @@ folder_get_authority (folder_t folder, authority_t *pauthority) |
268 | int | 273 | int |
269 | folder_get_observable (folder_t folder, observable_t *pobservable) | 274 | folder_get_observable (folder_t folder, observable_t *pobservable) |
270 | { | 275 | { |
271 | if (folder == NULL || pobservable == NULL) | 276 | if (folder == NULL) |
272 | return EINVAL; | 277 | return EINVAL; |
278 | if (pobservable == NULL) | ||
279 | return MU_ERR_OUT_PTR_NULL; | ||
273 | 280 | ||
274 | if (folder->observable == NULL) | 281 | if (folder->observable == NULL) |
275 | { | 282 | { |
... | @@ -304,8 +311,10 @@ folder_set_debug (folder_t folder, mu_debug_t debug) | ... | @@ -304,8 +311,10 @@ folder_set_debug (folder_t folder, mu_debug_t debug) |
304 | int | 311 | int |
305 | folder_get_debug (folder_t folder, mu_debug_t *pdebug) | 312 | folder_get_debug (folder_t folder, mu_debug_t *pdebug) |
306 | { | 313 | { |
307 | if (folder == NULL || pdebug == NULL) | 314 | if (folder == NULL) |
308 | return EINVAL; | 315 | return EINVAL; |
316 | if (pdebug == NULL) | ||
317 | return MU_ERR_OUT_PTR_NULL; | ||
309 | if (folder->debug == NULL) | 318 | if (folder->debug == NULL) |
310 | { | 319 | { |
311 | int status = mu_debug_create (&(folder->debug), folder); | 320 | int status = mu_debug_create (&(folder->debug), folder); |
... | @@ -391,8 +400,10 @@ folder_rename (folder_t folder, const char *oldname, const char *newname) | ... | @@ -391,8 +400,10 @@ folder_rename (folder_t folder, const char *oldname, const char *newname) |
391 | int | 400 | int |
392 | folder_get_url (folder_t folder, url_t *purl) | 401 | folder_get_url (folder_t folder, url_t *purl) |
393 | { | 402 | { |
394 | if (folder == NULL || purl == NULL) | 403 | if (folder == NULL) |
395 | return EINVAL; | 404 | return EINVAL; |
405 | if (purl == NULL) | ||
406 | return MU_ERR_OUT_PTR_NULL; | ||
396 | *purl = folder->url; | 407 | *purl = folder->url; |
397 | return 0; | 408 | return 0; |
398 | } | 409 | } | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -31,6 +31,7 @@ | ... | @@ -31,6 +31,7 @@ |
31 | #include <mailutils/stream.h> | 31 | #include <mailutils/stream.h> |
32 | #include <mailutils/address.h> | 32 | #include <mailutils/address.h> |
33 | #include <mailutils/mutil.h> | 33 | #include <mailutils/mutil.h> |
34 | #include <mailutils/errno.h> | ||
34 | 35 | ||
35 | #include <header0.h> | 36 | #include <header0.h> |
36 | 37 | ||
... | @@ -451,7 +452,7 @@ header_get_fvalue (header_t header, const char *name, char *buffer, | ... | @@ -451,7 +452,7 @@ header_get_fvalue (header_t header, const char *name, char *buffer, |
451 | { | 452 | { |
452 | size_t i, fn_len, fv_len = 0; | 453 | size_t i, fn_len, fv_len = 0; |
453 | size_t name_len; | 454 | size_t name_len; |
454 | int err = ENOENT; | 455 | int err = MU_ERR_NOENT; |
455 | 456 | ||
456 | for (i = 0, name_len = strlen (name); i < header->fhdr_count; i++) | 457 | for (i = 0, name_len = strlen (name); i < header->fhdr_count; i++) |
457 | { | 458 | { |
... | @@ -503,7 +504,7 @@ header_get_value (header_t header, const char *name, char *buffer, | ... | @@ -503,7 +504,7 @@ header_get_value (header_t header, const char *name, char *buffer, |
503 | switch (err) | 504 | switch (err) |
504 | { | 505 | { |
505 | case EINVAL: /* Permanent failure. */ | 506 | case EINVAL: /* Permanent failure. */ |
506 | err = ENOENT; | 507 | err = MU_ERR_NOENT; |
507 | case ENOMEM: | 508 | case ENOMEM: |
508 | if (pn) | 509 | if (pn) |
509 | *pn = 0; | 510 | *pn = 0; |
... | @@ -603,7 +604,7 @@ header_get_value (header_t header, const char *name, char *buffer, | ... | @@ -603,7 +604,7 @@ header_get_value (header_t header, const char *name, char *buffer, |
603 | if (pn) | 604 | if (pn) |
604 | *pn = total; | 605 | *pn = total; |
605 | 606 | ||
606 | return (total == 0) ? ENOENT : 0; | 607 | return (total == 0) ? MU_ERR_NOENT : 0; |
607 | } | 608 | } |
608 | 609 | ||
609 | int | 610 | int |
... | @@ -701,7 +702,7 @@ header_get_field_name (header_t header, size_t num, char *buf, | ... | @@ -701,7 +702,7 @@ header_get_field_name (header_t header, size_t num, char *buf, |
701 | } | 702 | } |
702 | 703 | ||
703 | if (header->hdr_count == 0 || num > header->hdr_count || num == 0) | 704 | if (header->hdr_count == 0 || num > header->hdr_count || num == 0) |
704 | return ENOENT; | 705 | return MU_ERR_NOENT; |
705 | 706 | ||
706 | num--; | 707 | num--; |
707 | len = (header->hdr[num].fn_end - header->hdr[num].fn); | 708 | len = (header->hdr[num].fn_end - header->hdr[num].fn); |
... | @@ -755,7 +756,7 @@ header_get_field_value (header_t header, size_t num, char *buf, | ... | @@ -755,7 +756,7 @@ header_get_field_value (header_t header, size_t num, char *buf, |
755 | } | 756 | } |
756 | 757 | ||
757 | if (header->hdr_count == 0 || num > header->hdr_count || num == 0) | 758 | if (header->hdr_count == 0 || num > header->hdr_count || num == 0) |
758 | return ENOENT; | 759 | return MU_ERR_NOENT; |
759 | 760 | ||
760 | num--; | 761 | num--; |
761 | len = header->hdr[num].fv_end - header->hdr[num].fv; | 762 | len = header->hdr[num].fv_end - header->hdr[num].fv; |
... | @@ -828,8 +829,11 @@ header_lines (header_t header, size_t *plines) | ... | @@ -828,8 +829,11 @@ header_lines (header_t header, size_t *plines) |
828 | { | 829 | { |
829 | int n; | 830 | int n; |
830 | size_t lines = 0; | 831 | size_t lines = 0; |
831 | if (header == NULL || plines == NULL) | 832 | |
833 | if (header == NULL) | ||
832 | return EINVAL; | 834 | return EINVAL; |
835 | if (plines == NULL) | ||
836 | return MU_ERR_OUT_PTR_NULL; | ||
833 | 837 | ||
834 | /* Overload. */ | 838 | /* Overload. */ |
835 | if (header->_lines) | 839 | if (header->_lines) |
... | @@ -1195,8 +1199,10 @@ header_readline (stream_t is, char *buf, size_t buflen, off_t off, size_t *pn) | ... | @@ -1195,8 +1199,10 @@ header_readline (stream_t is, char *buf, size_t buflen, off_t off, size_t *pn) |
1195 | int | 1199 | int |
1196 | header_get_stream (header_t header, stream_t *pstream) | 1200 | header_get_stream (header_t header, stream_t *pstream) |
1197 | { | 1201 | { |
1198 | if (header == NULL || pstream == NULL) | 1202 | if (header == NULL) |
1199 | return EINVAL; | 1203 | return EINVAL; |
1204 | if (pstream == NULL) | ||
1205 | return MU_ERR_OUT_PTR_NULL; | ||
1200 | if (header->stream == NULL) | 1206 | if (header->stream == NULL) |
1201 | { | 1207 | { |
1202 | int status = stream_create (&(header->stream), MU_STREAM_RDWR, header); | 1208 | int status = stream_create (&(header->stream), MU_STREAM_RDWR, header); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -802,7 +802,7 @@ folder_imap_list (folder_t folder, const char *ref, const char *name, | ... | @@ -802,7 +802,7 @@ folder_imap_list (folder_t folder, const char *ref, const char *name, |
802 | 802 | ||
803 | /* NOOP. */ | 803 | /* NOOP. */ |
804 | if (pflist == NULL) | 804 | if (pflist == NULL) |
805 | return EINVAL; | 805 | return MU_ERR_OUT_NULL; |
806 | 806 | ||
807 | status = folder_open (folder, folder->flags); | 807 | status = folder_open (folder, folder->flags); |
808 | if (status != 0) | 808 | if (status != 0) |
... | @@ -960,7 +960,7 @@ folder_imap_lsub (folder_t folder, const char *ref, const char *name, | ... | @@ -960,7 +960,7 @@ folder_imap_lsub (folder_t folder, const char *ref, const char *name, |
960 | 960 | ||
961 | /* NOOP. */ | 961 | /* NOOP. */ |
962 | if (pflist == NULL) | 962 | if (pflist == NULL) |
963 | return EINVAL; | 963 | return MU_ERR_OUT_NULL; |
964 | 964 | ||
965 | status = folder_open (folder, folder->flags); | 965 | status = folder_open (folder, folder->flags); |
966 | if (status != 0) | 966 | if (status != 0) |
... | @@ -1031,6 +1031,7 @@ folder_imap_rename (folder_t folder, const char *oldpath, const char *newpath) | ... | @@ -1031,6 +1031,7 @@ folder_imap_rename (folder_t folder, const char *oldpath, const char *newpath) |
1031 | { | 1031 | { |
1032 | f_imap_t f_imap = folder->data; | 1032 | f_imap_t f_imap = folder->data; |
1033 | int status = 0; | 1033 | int status = 0; |
1034 | |||
1034 | if (oldpath == NULL || newpath == NULL) | 1035 | if (oldpath == NULL || newpath == NULL) |
1035 | return EINVAL; | 1036 | return EINVAL; |
1036 | 1037 | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -36,6 +36,7 @@ | ... | @@ -36,6 +36,7 @@ |
36 | #include <mailutils/debug.h> | 36 | #include <mailutils/debug.h> |
37 | #include <mailutils/envelope.h> | 37 | #include <mailutils/envelope.h> |
38 | #include <mailutils/error.h> | 38 | #include <mailutils/error.h> |
39 | #include <mailutils/errno.h> | ||
39 | #include <mailutils/header.h> | 40 | #include <mailutils/header.h> |
40 | #include <mailutils/message.h> | 41 | #include <mailutils/message.h> |
41 | #include <mailutils/mutil.h> | 42 | #include <mailutils/mutil.h> |
... | @@ -441,7 +442,9 @@ imap_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg) | ... | @@ -441,7 +442,9 @@ imap_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg) |
441 | msg_imap_t msg_imap; | 442 | msg_imap_t msg_imap; |
442 | int status = 0; | 443 | int status = 0; |
443 | 444 | ||
444 | if (pmsg == NULL || msgno == 0 || msgno > m_imap->messages_count) | 445 | if (pmsg == NULL) |
446 | return MU_ERR_OUT_PTR_NULL; | ||
447 | if (msgno == 0 || msgno > m_imap->messages_count) | ||
445 | return EINVAL; | 448 | return EINVAL; |
446 | 449 | ||
447 | /* Check to see if we have already this message. */ | 450 | /* Check to see if we have already this message. */ |
... | @@ -1768,7 +1771,7 @@ imap_header_get_value (header_t header, const char *field, char * buffer, | ... | @@ -1768,7 +1771,7 @@ imap_header_get_value (header_t header, const char *field, char * buffer, |
1768 | if (plen) | 1771 | if (plen) |
1769 | *plen = len; | 1772 | *plen = len; |
1770 | if (len == 0) | 1773 | if (len == 0) |
1771 | status = ENOENT; | 1774 | status = MU_ERR_NOENT; |
1772 | } | 1775 | } |
1773 | free (value); | 1776 | free (value); |
1774 | return status; | 1777 | return status; |
... | @@ -2057,7 +2060,7 @@ fetch_operation (f_imap_t f_imap, msg_imap_t msg_imap, char *buffer, | ... | @@ -2057,7 +2060,7 @@ fetch_operation (f_imap_t f_imap, msg_imap_t msg_imap, char *buffer, |
2057 | 2060 | ||
2058 | /* The server may have timeout any case connection is gone away. */ | 2061 | /* The server may have timeout any case connection is gone away. */ |
2059 | if (status == 0 && f_imap->isopen == 0 && f_imap->string.offset == 0) | 2062 | if (status == 0 && f_imap->isopen == 0 && f_imap->string.offset == 0) |
2060 | status = EBADF; | 2063 | status = MU_ERR_CONN_CLOSED; |
2061 | 2064 | ||
2062 | if (buffer) | 2065 | if (buffer) |
2063 | stream_read (f_imap->string.stream, buffer, buflen, 0, plen); | 2066 | stream_read (f_imap->string.stream, buffer, buflen, 0, plen); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -24,12 +24,15 @@ | ... | @@ -24,12 +24,15 @@ |
24 | 24 | ||
25 | #include <list0.h> | 25 | #include <list0.h> |
26 | #include <iterator0.h> | 26 | #include <iterator0.h> |
27 | #include <mailutils/errno.h> | ||
27 | 28 | ||
28 | int | 29 | int |
29 | iterator_create (iterator_t *piterator, list_t list) | 30 | iterator_create (iterator_t *piterator, list_t list) |
30 | { | 31 | { |
31 | iterator_t iterator; | 32 | iterator_t iterator; |
32 | if (piterator == NULL || list == NULL) | 33 | if (piterator == NULL) |
34 | return MU_ERR_OUT_PTR_NULL; | ||
35 | if (list == NULL) | ||
33 | return EINVAL; | 36 | return EINVAL; |
34 | iterator = calloc (sizeof (*iterator), 1); | 37 | iterator = calloc (sizeof (*iterator), 1); |
35 | if (iterator == NULL) | 38 | if (iterator == NULL) |
... | @@ -48,7 +51,9 @@ iterator_dup (iterator_t *piterator, iterator_t orig) | ... | @@ -48,7 +51,9 @@ iterator_dup (iterator_t *piterator, iterator_t orig) |
48 | { | 51 | { |
49 | iterator_t iterator; | 52 | iterator_t iterator; |
50 | 53 | ||
51 | if (piterator == NULL || orig == NULL) | 54 | if (piterator == NULL) |
55 | return MU_ERR_OUT_PTR_NULL; | ||
56 | if (orig == NULL) | ||
52 | return EINVAL; | 57 | return EINVAL; |
53 | iterator = calloc (sizeof (*iterator), 1); | 58 | iterator = calloc (sizeof (*iterator), 1); |
54 | if (iterator == NULL) | 59 | if (iterator == NULL) |
... | @@ -108,7 +113,7 @@ int | ... | @@ -108,7 +113,7 @@ int |
108 | iterator_current (iterator_t iterator, void **pitem) | 113 | iterator_current (iterator_t iterator, void **pitem) |
109 | { | 114 | { |
110 | if (!iterator->cur) | 115 | if (!iterator->cur) |
111 | return ENOENT; | 116 | return MU_ERR_NOENT; |
112 | *pitem = iterator->cur->item; | 117 | *pitem = iterator->cur->item; |
113 | return 0; | 118 | return 0; |
114 | } | 119 | } |
... | @@ -126,7 +131,9 @@ iterator_get_list (iterator_t iterator, list_t *plist) | ... | @@ -126,7 +131,9 @@ iterator_get_list (iterator_t iterator, list_t *plist) |
126 | { | 131 | { |
127 | if (!iterator) | 132 | if (!iterator) |
128 | return EINVAL; | 133 | return EINVAL; |
129 | *plist = iterator->list; | 134 | if (!plist) |
135 | return MU_ERR_OUT_PTR_NULL; | ||
136 | *plist = iterator->list; | ||
130 | return 0; | 137 | return 0; |
131 | } | 138 | } |
132 | 139 | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
24 | 24 | ||
25 | #include <list0.h> | 25 | #include <list0.h> |
26 | #include <iterator0.h> | 26 | #include <iterator0.h> |
27 | #include <mailutils/errno.h> | ||
27 | 28 | ||
28 | int | 29 | int |
29 | list_create (list_t *plist) | 30 | list_create (list_t *plist) |
... | @@ -32,7 +33,7 @@ list_create (list_t *plist) | ... | @@ -32,7 +33,7 @@ list_create (list_t *plist) |
32 | int status; | 33 | int status; |
33 | 34 | ||
34 | if (plist == NULL) | 35 | if (plist == NULL) |
35 | return EINVAL; | 36 | return MU_ERR_OUT_PTR_NULL; |
36 | list = calloc (sizeof (*list), 1); | 37 | list = calloc (sizeof (*list), 1); |
37 | if (list == NULL) | 38 | if (list == NULL) |
38 | return ENOMEM; | 39 | return ENOMEM; |
... | @@ -131,8 +132,10 @@ list_is_empty (list_t list) | ... | @@ -131,8 +132,10 @@ list_is_empty (list_t list) |
131 | int | 132 | int |
132 | list_count (list_t list, size_t *pcount) | 133 | list_count (list_t list, size_t *pcount) |
133 | { | 134 | { |
134 | if (list == NULL || pcount == NULL) | 135 | if (list == NULL) |
135 | return EINVAL; | 136 | return EINVAL; |
137 | if (pcount == NULL) | ||
138 | return MU_ERR_OUT_PTR_NULL; | ||
136 | *pcount = list->count; | 139 | *pcount = list->count; |
137 | return 0; | 140 | return 0; |
138 | } | 141 | } |
... | @@ -160,7 +163,7 @@ list_locate (list_t list, void *item, void **ret_item) | ... | @@ -160,7 +163,7 @@ list_locate (list_t list, void *item, void **ret_item) |
160 | { | 163 | { |
161 | struct list_data *current, *previous; | 164 | struct list_data *current, *previous; |
162 | list_comparator_t comp; | 165 | list_comparator_t comp; |
163 | int status = ENOENT; | 166 | int status = MU_ERR_NOENT; |
164 | 167 | ||
165 | if (list == NULL) | 168 | if (list == NULL) |
166 | return EINVAL; | 169 | return EINVAL; |
... | @@ -186,7 +189,7 @@ list_insert (list_t list, void *item, void *new_item) | ... | @@ -186,7 +189,7 @@ list_insert (list_t list, void *item, void *new_item) |
186 | { | 189 | { |
187 | struct list_data *current; | 190 | struct list_data *current; |
188 | list_comparator_t comp; | 191 | list_comparator_t comp; |
189 | int status = ENOENT; | 192 | int status = MU_ERR_NOENT; |
190 | 193 | ||
191 | if (list == NULL) | 194 | if (list == NULL) |
192 | return EINVAL; | 195 | return EINVAL; |
... | @@ -230,7 +233,7 @@ list_remove (list_t list, void *item) | ... | @@ -230,7 +233,7 @@ list_remove (list_t list, void *item) |
230 | { | 233 | { |
231 | struct list_data *current, *previous; | 234 | struct list_data *current, *previous; |
232 | list_comparator_t comp; | 235 | list_comparator_t comp; |
233 | int status = ENOENT; | 236 | int status = MU_ERR_NOENT; |
234 | 237 | ||
235 | if (list == NULL) | 238 | if (list == NULL) |
236 | return EINVAL; | 239 | return EINVAL; |
... | @@ -259,7 +262,7 @@ list_replace (list_t list, void *old_item, void *new_item) | ... | @@ -259,7 +262,7 @@ list_replace (list_t list, void *old_item, void *new_item) |
259 | { | 262 | { |
260 | struct list_data *current, *previous; | 263 | struct list_data *current, *previous; |
261 | list_comparator_t comp; | 264 | list_comparator_t comp; |
262 | int status = ENOENT; | 265 | int status = MU_ERR_NOENT; |
263 | 266 | ||
264 | if (list == NULL) | 267 | if (list == NULL) |
265 | return EINVAL; | 268 | return EINVAL; |
... | @@ -284,10 +287,12 @@ list_get (list_t list, size_t indx, void **pitem) | ... | @@ -284,10 +287,12 @@ list_get (list_t list, size_t indx, void **pitem) |
284 | { | 287 | { |
285 | struct list_data *current; | 288 | struct list_data *current; |
286 | size_t count; | 289 | size_t count; |
287 | int status = ENOENT; | 290 | int status = MU_ERR_NOENT; |
288 | 291 | ||
289 | if (list == NULL || pitem == NULL) | 292 | if (list == NULL) |
290 | return EINVAL; | 293 | return EINVAL; |
294 | if (pitem == NULL) | ||
295 | return MU_ERR_OUT_PTR_NULL; | ||
291 | monitor_rdlock (list->monitor); | 296 | monitor_rdlock (list->monitor); |
292 | for (current = list->head.next, count = 0; current != &(list->head); | 297 | for (current = list->head.next, count = 0; current != &(list->head); |
293 | current = current->next, count++) | 298 | current = current->next, count++) | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -55,10 +55,10 @@ mu_mailcap_create (mu_mailcap_t * pmailcap, stream_t stream) | ... | @@ -55,10 +55,10 @@ mu_mailcap_create (mu_mailcap_t * pmailcap, stream_t stream) |
55 | mu_mailcap_t mailcap; | 55 | mu_mailcap_t mailcap; |
56 | int status = 0; | 56 | int status = 0; |
57 | 57 | ||
58 | if (stream == NULL || pmailcap == NULL) | 58 | if (stream == NULL) |
59 | { | 59 | return EINVAL; |
60 | return EINVAL; | 60 | if (pmailcap == NULL) |
61 | } | 61 | return MU_ERR_OUT_PTR_NULL; |
62 | 62 | ||
63 | mailcap = calloc (1, sizeof (*mailcap)); | 63 | mailcap = calloc (1, sizeof (*mailcap)); |
64 | if (mailcap != NULL) | 64 | if (mailcap != NULL) |
... | @@ -106,10 +106,9 @@ int | ... | @@ -106,10 +106,9 @@ int |
106 | mu_mailcap_entries_count (mu_mailcap_t mailcap, size_t *pcount) | 106 | mu_mailcap_entries_count (mu_mailcap_t mailcap, size_t *pcount) |
107 | { | 107 | { |
108 | int status = 0; | 108 | int status = 0; |
109 | |||
109 | if (mailcap == NULL) | 110 | if (mailcap == NULL) |
110 | { | 111 | status = EINVAL; |
111 | status = EINVAL; | ||
112 | } | ||
113 | if (pcount != NULL) | 112 | if (pcount != NULL) |
114 | { | 113 | { |
115 | *pcount = mailcap->entries_count; | 114 | *pcount = mailcap->entries_count; |
... | @@ -122,13 +121,13 @@ mu_mailcap_get_entry (mu_mailcap_t mailcap, size_t no, | ... | @@ -122,13 +121,13 @@ mu_mailcap_get_entry (mu_mailcap_t mailcap, size_t no, |
122 | mu_mailcap_entry_t *pentry) | 121 | mu_mailcap_entry_t *pentry) |
123 | { | 122 | { |
124 | int status = 0; | 123 | int status = 0; |
125 | if (mailcap == NULL || pentry == NULL) | 124 | if (mailcap == NULL) |
126 | { | 125 | status = EINVAL; |
127 | status = EINVAL; | 126 | else if (pentry == NULL) |
128 | } | 127 | status = MU_ERR_OUT_PTR_NULL; |
129 | else if (no == 0 || no > mailcap->entries_count) | 128 | else if (no == 0 || no > mailcap->entries_count) |
130 | { | 129 | { |
131 | status = ENOENT; | 130 | status = MU_ERR_NOENT; |
132 | } | 131 | } |
133 | else | 132 | else |
134 | { | 133 | { |
... | @@ -223,7 +222,7 @@ mu_mailcap_entry_get_field (mu_mailcap_entry_t entry, size_t no, | ... | @@ -223,7 +222,7 @@ mu_mailcap_entry_get_field (mu_mailcap_entry_t entry, size_t no, |
223 | } | 222 | } |
224 | else if ( no == 0 || no > entry->fields_count) | 223 | else if ( no == 0 || no > entry->fields_count) |
225 | { | 224 | { |
226 | status = ENOENT; | 225 | status = MU_ERR_NOENT; |
227 | } | 226 | } |
228 | else | 227 | else |
229 | { | 228 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -92,7 +92,7 @@ mailer_create (mailer_t * pmailer, const char *name) | ... | @@ -92,7 +92,7 @@ mailer_create (mailer_t * pmailer, const char *name) |
92 | int found = 0; | 92 | int found = 0; |
93 | 93 | ||
94 | if (pmailer == NULL) | 94 | if (pmailer == NULL) |
95 | return EINVAL; | 95 | return MU_ERR_OUT_PTR_NULL; |
96 | 96 | ||
97 | if (name == NULL) | 97 | if (name == NULL) |
98 | mailer_get_url_default (&name); | 98 | mailer_get_url_default (&name); |
... | @@ -339,10 +339,11 @@ mailer_set_stream (mailer_t mailer, stream_t stream) | ... | @@ -339,10 +339,11 @@ mailer_set_stream (mailer_t mailer, stream_t stream) |
339 | int | 339 | int |
340 | mailer_get_stream (mailer_t mailer, stream_t * pstream) | 340 | mailer_get_stream (mailer_t mailer, stream_t * pstream) |
341 | { | 341 | { |
342 | if (mailer == NULL || pstream == NULL) | 342 | if (mailer == NULL) |
343 | return EINVAL; | 343 | return EINVAL; |
344 | if (pstream) | 344 | if (pstream == NULL) |
345 | *pstream = mailer->stream; | 345 | return MU_ERR_OUT_PTR_NULL; |
346 | *pstream = mailer->stream; | ||
346 | return 0; | 347 | return 0; |
347 | } | 348 | } |
348 | 349 | ||
... | @@ -350,9 +351,10 @@ int | ... | @@ -350,9 +351,10 @@ int |
350 | mailer_get_observable (mailer_t mailer, observable_t * pobservable) | 351 | mailer_get_observable (mailer_t mailer, observable_t * pobservable) |
351 | { | 352 | { |
352 | /* FIXME: I should check for invalid types */ | 353 | /* FIXME: I should check for invalid types */ |
353 | if (mailer == NULL || pobservable == NULL) | 354 | if (mailer == NULL) |
354 | return EINVAL; | 355 | return EINVAL; |
355 | 356 | if (pobservable == NULL) | |
357 | return MU_ERR_OUT_PTR_NULL; | ||
356 | if (mailer->observable == NULL) | 358 | if (mailer->observable == NULL) |
357 | { | 359 | { |
358 | int status = observable_create (&(mailer->observable), mailer); | 360 | int status = observable_create (&(mailer->observable), mailer); |
... | @@ -366,8 +368,10 @@ mailer_get_observable (mailer_t mailer, observable_t * pobservable) | ... | @@ -366,8 +368,10 @@ mailer_get_observable (mailer_t mailer, observable_t * pobservable) |
366 | int | 368 | int |
367 | mailer_get_property (mailer_t mailer, property_t * pproperty) | 369 | mailer_get_property (mailer_t mailer, property_t * pproperty) |
368 | { | 370 | { |
369 | if (mailer == NULL || pproperty == NULL) | 371 | if (mailer == NULL) |
370 | return EINVAL; | 372 | return EINVAL; |
373 | if (pproperty == NULL) | ||
374 | return MU_ERR_OUT_PTR_NULL; | ||
371 | if (mailer->property == NULL) | 375 | if (mailer->property == NULL) |
372 | { | 376 | { |
373 | int status = property_create (&(mailer->property), mailer); | 377 | int status = property_create (&(mailer->property), mailer); |
... | @@ -391,8 +395,10 @@ mailer_set_debug (mailer_t mailer, mu_debug_t debug) | ... | @@ -391,8 +395,10 @@ mailer_set_debug (mailer_t mailer, mu_debug_t debug) |
391 | int | 395 | int |
392 | mailer_get_debug (mailer_t mailer, mu_debug_t * pdebug) | 396 | mailer_get_debug (mailer_t mailer, mu_debug_t * pdebug) |
393 | { | 397 | { |
394 | if (mailer == NULL || pdebug == NULL) | 398 | if (mailer == NULL) |
395 | return EINVAL; | 399 | return EINVAL; |
400 | if (pdebug == NULL) | ||
401 | return MU_ERR_OUT_PTR_NULL; | ||
396 | if (mailer->debug == NULL) | 402 | if (mailer->debug == NULL) |
397 | { | 403 | { |
398 | int status = mu_debug_create (&(mailer->debug), mailer); | 404 | int status = mu_debug_create (&(mailer->debug), mailer); |
... | @@ -406,8 +412,10 @@ mailer_get_debug (mailer_t mailer, mu_debug_t * pdebug) | ... | @@ -406,8 +412,10 @@ mailer_get_debug (mailer_t mailer, mu_debug_t * pdebug) |
406 | int | 412 | int |
407 | mailer_get_url (mailer_t mailer, url_t * purl) | 413 | mailer_get_url (mailer_t mailer, url_t * purl) |
408 | { | 414 | { |
409 | if (!mailer || !purl) | 415 | if (!mailer) |
410 | return EINVAL; | 416 | return EINVAL; |
417 | if (!purl) | ||
418 | return MU_ERR_OUT_PTR_NULL; | ||
411 | *purl = mailer->url; | 419 | *purl = mailer->url; |
412 | return 0; | 420 | return 0; |
413 | } | 421 | } | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | 31 | ||
32 | #include <mailutils/stream.h> | 32 | #include <mailutils/stream.h> |
33 | #include <mailutils/errno.h> | ||
33 | 34 | ||
34 | #ifdef _POSIX_MAPPED_FILES | 35 | #ifdef _POSIX_MAPPED_FILES |
35 | #include <sys/mman.h> | 36 | #include <sys/mman.h> |
... | @@ -347,7 +348,9 @@ mapfile_stream_create (stream_t *stream, const char* filename, int flags) | ... | @@ -347,7 +348,9 @@ mapfile_stream_create (stream_t *stream, const char* filename, int flags) |
347 | struct _mapfile_stream *fs; | 348 | struct _mapfile_stream *fs; |
348 | int ret; | 349 | int ret; |
349 | 350 | ||
350 | if (stream == NULL || filename == NULL) | 351 | if (stream == NULL) |
352 | return MU_ERR_OUT_PTR_NULL; | ||
353 | if (filename == NULL) | ||
351 | return EINVAL; | 354 | return EINVAL; |
352 | 355 | ||
353 | fs = calloc (1, sizeof (struct _mapfile_stream)); | 356 | fs = calloc (1, sizeof (struct _mapfile_stream)); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -38,6 +38,7 @@ | ... | @@ -38,6 +38,7 @@ |
38 | #include <mailutils/url.h> | 38 | #include <mailutils/url.h> |
39 | #include <mailutils/stream.h> | 39 | #include <mailutils/stream.h> |
40 | #include <mailutils/mutil.h> | 40 | #include <mailutils/mutil.h> |
41 | #include <mailutils/errno.h> | ||
41 | 42 | ||
42 | /* We export url parsing and the initialisation of | 43 | /* We export url parsing and the initialisation of |
43 | the mailbox, via the register entry/record. */ | 44 | the mailbox, via the register entry/record. */ |
... | @@ -327,7 +328,7 @@ folder_mbox_lsub (folder_t folder, const char *ref ARG_UNUSED, const char *name, | ... | @@ -327,7 +328,7 @@ folder_mbox_lsub (folder_t folder, const char *ref ARG_UNUSED, const char *name, |
327 | size_t j = 0; | 328 | size_t j = 0; |
328 | 329 | ||
329 | if (pflist == NULL) | 330 | if (pflist == NULL) |
330 | return EINVAL; | 331 | return MU_ERR_OUT_NULL; |
331 | 332 | ||
332 | if (name == NULL || *name == '\0') | 333 | if (name == NULL || *name == '\0') |
333 | name = "*"; | 334 | name = "*"; |
... | @@ -393,7 +394,7 @@ folder_mbox_unsubscribe (folder_t folder, const char *name) | ... | @@ -393,7 +394,7 @@ folder_mbox_unsubscribe (folder_t folder, const char *name) |
393 | return 0; | 394 | return 0; |
394 | } | 395 | } |
395 | } | 396 | } |
396 | return ENOENT; | 397 | return MU_ERR_NOENT; |
397 | } | 398 | } |
398 | 399 | ||
399 | static char * | 400 | static char * | ... | ... |
... | @@ -985,7 +985,7 @@ mbox_header_get_fvalue (header_t header, const char *name, char *buffer, | ... | @@ -985,7 +985,7 @@ mbox_header_get_fvalue (header_t header, const char *name, char *buffer, |
985 | size_t i, fv_len = 0; | 985 | size_t i, fv_len = 0; |
986 | message_t msg = header_get_owner (header); | 986 | message_t msg = header_get_owner (header); |
987 | mbox_message_t mum = message_get_owner (msg); | 987 | mbox_message_t mum = message_get_owner (msg); |
988 | int err = ENOENT; | 988 | int err = MU_ERR_NOENT; |
989 | for (i = 0; i < HDRSIZE; i++) | 989 | for (i = 0; i < HDRSIZE; i++) |
990 | { | 990 | { |
991 | if (*name == *(fhdr_table[i]) && strcasecmp (fhdr_table[i], name) == 0) | 991 | if (*name == *(fhdr_table[i]) && strcasecmp (fhdr_table[i], name) == 0) |
... | @@ -1004,7 +1004,7 @@ mbox_header_get_fvalue (header_t header, const char *name, char *buffer, | ... | @@ -1004,7 +1004,7 @@ mbox_header_get_fvalue (header_t header, const char *name, char *buffer, |
1004 | err = 0; | 1004 | err = 0; |
1005 | } | 1005 | } |
1006 | else | 1006 | else |
1007 | err = ENOENT; | 1007 | err = MU_ERR_NOENT; |
1008 | break; | 1008 | break; |
1009 | } | 1009 | } |
1010 | } | 1010 | } |
... | @@ -1168,7 +1168,9 @@ mbox_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg) | ... | @@ -1168,7 +1168,9 @@ mbox_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg) |
1168 | message_t msg = NULL; | 1168 | message_t msg = NULL; |
1169 | 1169 | ||
1170 | /* Sanity checks. */ | 1170 | /* Sanity checks. */ |
1171 | if (pmsg == NULL || mud == NULL) | 1171 | if (pmsg == NULL) |
1172 | return MU_ERR_OUT_PTR_NULL; | ||
1173 | if (mud == NULL) | ||
1172 | return EINVAL; | 1174 | return EINVAL; |
1173 | 1175 | ||
1174 | /* If we did not start a scanning yet do it now. */ | 1176 | /* If we did not start a scanning yet do it now. */ |
... | @@ -1288,6 +1290,7 @@ mbox_append_message (mailbox_t mailbox, message_t msg) | ... | @@ -1288,6 +1290,7 @@ mbox_append_message (mailbox_t mailbox, message_t msg) |
1288 | { | 1290 | { |
1289 | int status = 0; | 1291 | int status = 0; |
1290 | mbox_data_t mud = mailbox->data; | 1292 | mbox_data_t mud = mailbox->data; |
1293 | |||
1291 | if (msg == NULL || mud == NULL) | 1294 | if (msg == NULL || mud == NULL) |
1292 | return EINVAL; | 1295 | return EINVAL; |
1293 | 1296 | ||
... | @@ -1661,6 +1664,7 @@ static int | ... | @@ -1661,6 +1664,7 @@ static int |
1661 | mbox_messages_count (mailbox_t mailbox, size_t *pcount) | 1664 | mbox_messages_count (mailbox_t mailbox, size_t *pcount) |
1662 | { | 1665 | { |
1663 | mbox_data_t mud = mailbox->data; | 1666 | mbox_data_t mud = mailbox->data; |
1667 | |||
1664 | if (mud == NULL) | 1668 | if (mud == NULL) |
1665 | return EINVAL; | 1669 | return EINVAL; |
1666 | 1670 | ... | ... |
... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
30 | 30 | ||
31 | #include <registrar0.h> | 31 | #include <registrar0.h> |
32 | #include <url0.h> | 32 | #include <url0.h> |
33 | #include <mailutils/errno.h> | ||
33 | 34 | ||
34 | static void url_mbox_destroy (url_t purl); | 35 | static void url_mbox_destroy (url_t purl); |
35 | 36 | ||
... | @@ -225,7 +226,7 @@ _url_mbox_init (url_t url) | ... | @@ -225,7 +226,7 @@ _url_mbox_init (url_t url) |
225 | else | 226 | else |
226 | { | 227 | { |
227 | url_mbox_destroy (url); | 228 | url_mbox_destroy (url); |
228 | return ENOENT; | 229 | return MU_ERR_NOENT; |
229 | } | 230 | } |
230 | } | 231 | } |
231 | else if (strncasecmp (p, "user=", 5) == 0) | 232 | else if (strncasecmp (p, "user=", 5) == 0) |
... | @@ -248,7 +249,7 @@ _url_mbox_init (url_t url) | ... | @@ -248,7 +249,7 @@ _url_mbox_init (url_t url) |
248 | else | 249 | else |
249 | { | 250 | { |
250 | url_mbox_destroy (url); | 251 | url_mbox_destroy (url); |
251 | return ENOENT; | 252 | return MU_ERR_NOENT; |
252 | } | 253 | } |
253 | } | 254 | } |
254 | 255 | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -303,7 +303,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail) | ... | @@ -303,7 +303,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail) |
303 | 303 | ||
304 | /* Sanity. */ | 304 | /* Sanity. */ |
305 | if (pmbox == NULL) | 305 | if (pmbox == NULL) |
306 | return EINVAL; | 306 | return MU_ERR_OUT_PTR_NULL; |
307 | 307 | ||
308 | /* Other utilities may not understand GNU mailutils url namespace, so | 308 | /* Other utilities may not understand GNU mailutils url namespace, so |
309 | use FOLDER instead, to not confuse others by using MAIL. */ | 309 | use FOLDER instead, to not confuse others by using MAIL. */ | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -29,6 +29,7 @@ | ... | @@ -29,6 +29,7 @@ |
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | 30 | ||
31 | #include <mailutils/stream.h> | 31 | #include <mailutils/stream.h> |
32 | #include <mailutils/errno.h> | ||
32 | 33 | ||
33 | #undef min | 34 | #undef min |
34 | #define min(a,b) ((a) < (b) ? (a) : (b)) | 35 | #define min(a,b) ((a) < (b) ? (a) : (b)) |
... | @@ -221,7 +222,7 @@ memory_stream_create (stream_t * stream, const char *filename, int flags) | ... | @@ -221,7 +222,7 @@ memory_stream_create (stream_t * stream, const char *filename, int flags) |
221 | int ret; | 222 | int ret; |
222 | 223 | ||
223 | if (stream == NULL) | 224 | if (stream == NULL) |
224 | return EINVAL; | 225 | return MU_ERR_OUT_PTR_NULL; |
225 | 226 | ||
226 | mfs = calloc (1, sizeof (*mfs)); | 227 | mfs = calloc (1, sizeof (*mfs)); |
227 | 228 | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -76,7 +76,7 @@ message_create (message_t *pmsg, void *owner) | ... | @@ -76,7 +76,7 @@ message_create (message_t *pmsg, void *owner) |
76 | int status; | 76 | int status; |
77 | 77 | ||
78 | if (pmsg == NULL) | 78 | if (pmsg == NULL) |
79 | return EINVAL; | 79 | return MU_ERR_OUT_PTR_NULL; |
80 | msg = calloc (1, sizeof (*msg)); | 80 | msg = calloc (1, sizeof (*msg)); |
81 | if (msg == NULL) | 81 | if (msg == NULL) |
82 | return ENOMEM; | 82 | return ENOMEM; |
... | @@ -173,7 +173,9 @@ message_create_copy (message_t *to, message_t from) | ... | @@ -173,7 +173,9 @@ message_create_copy (message_t *to, message_t from) |
173 | size_t n = 0; | 173 | size_t n = 0; |
174 | char buf[512]; | 174 | char buf[512]; |
175 | 175 | ||
176 | if(!to || !from) | 176 | if (!to) |
177 | return MU_ERR_OUT_PTR_NULL; | ||
178 | if (!from) | ||
177 | return EINVAL; | 179 | return EINVAL; |
178 | 180 | ||
179 | if((status = message_create (to, NULL))) | 181 | if((status = message_create (to, NULL))) |
... | @@ -249,8 +251,10 @@ message_clear_modified (message_t msg) | ... | @@ -249,8 +251,10 @@ message_clear_modified (message_t msg) |
249 | int | 251 | int |
250 | message_get_mailbox (message_t msg, mailbox_t *pmailbox) | 252 | message_get_mailbox (message_t msg, mailbox_t *pmailbox) |
251 | { | 253 | { |
252 | if (msg == NULL || pmailbox == NULL) | 254 | if (msg == NULL) |
253 | return EINVAL; | 255 | return EINVAL; |
256 | if (pmailbox == NULL) | ||
257 | return MU_ERR_OUT_PTR_NULL; | ||
254 | *pmailbox = msg->mailbox; | 258 | *pmailbox = msg->mailbox; |
255 | return 0; | 259 | return 0; |
256 | } | 260 | } |
... | @@ -269,8 +273,10 @@ message_set_mailbox (message_t msg, mailbox_t mailbox, void *owner) | ... | @@ -269,8 +273,10 @@ message_set_mailbox (message_t msg, mailbox_t mailbox, void *owner) |
269 | int | 273 | int |
270 | message_get_header (message_t msg, header_t *phdr) | 274 | message_get_header (message_t msg, header_t *phdr) |
271 | { | 275 | { |
272 | if (msg == NULL || phdr == NULL) | 276 | if (msg == NULL) |
273 | return EINVAL; | 277 | return EINVAL; |
278 | if (phdr == NULL) | ||
279 | return MU_ERR_OUT_PTR_NULL; | ||
274 | 280 | ||
275 | /* Is it a floating mesg */ | 281 | /* Is it a floating mesg */ |
276 | if (msg->header == NULL) | 282 | if (msg->header == NULL) |
... | @@ -311,8 +317,10 @@ message_set_header (message_t msg, header_t hdr, void *owner) | ... | @@ -311,8 +317,10 @@ message_set_header (message_t msg, header_t hdr, void *owner) |
311 | int | 317 | int |
312 | message_get_body (message_t msg, body_t *pbody) | 318 | message_get_body (message_t msg, body_t *pbody) |
313 | { | 319 | { |
314 | if (msg == NULL || pbody == NULL) | 320 | if (msg == NULL) |
315 | return EINVAL; | 321 | return EINVAL; |
322 | if (pbody == NULL) | ||
323 | return MU_ERR_OUT_PTR_NULL; | ||
316 | 324 | ||
317 | /* Is it a floating mesg. */ | 325 | /* Is it a floating mesg. */ |
318 | if (msg->body == NULL) | 326 | if (msg->body == NULL) |
... | @@ -382,8 +390,10 @@ message_set_stream (message_t msg, stream_t stream, void *owner) | ... | @@ -382,8 +390,10 @@ message_set_stream (message_t msg, stream_t stream, void *owner) |
382 | int | 390 | int |
383 | message_get_stream (message_t msg, stream_t *pstream) | 391 | message_get_stream (message_t msg, stream_t *pstream) |
384 | { | 392 | { |
385 | if (msg == NULL || pstream == NULL) | 393 | if (msg == NULL) |
386 | return EINVAL; | 394 | return EINVAL; |
395 | if (pstream == NULL) | ||
396 | return MU_ERR_OUT_PTR_NULL; | ||
387 | 397 | ||
388 | if (msg->stream == NULL) | 398 | if (msg->stream == NULL) |
389 | { | 399 | { |
... | @@ -478,8 +488,10 @@ message_size (message_t msg, size_t *psize) | ... | @@ -478,8 +488,10 @@ message_size (message_t msg, size_t *psize) |
478 | int | 488 | int |
479 | message_get_envelope (message_t msg, envelope_t *penvelope) | 489 | message_get_envelope (message_t msg, envelope_t *penvelope) |
480 | { | 490 | { |
481 | if (msg == NULL || penvelope == NULL) | 491 | if (msg == NULL) |
482 | return EINVAL; | 492 | return EINVAL; |
493 | if (penvelope == NULL) | ||
494 | return MU_ERR_OUT_PTR_NULL; | ||
483 | 495 | ||
484 | if (msg->envelope == NULL) | 496 | if (msg->envelope == NULL) |
485 | { | 497 | { |
... | @@ -512,9 +524,10 @@ message_set_envelope (message_t msg, envelope_t envelope, void *owner) | ... | @@ -512,9 +524,10 @@ message_set_envelope (message_t msg, envelope_t envelope, void *owner) |
512 | int | 524 | int |
513 | message_get_attribute (message_t msg, attribute_t *pattribute) | 525 | message_get_attribute (message_t msg, attribute_t *pattribute) |
514 | { | 526 | { |
515 | if (msg == NULL || pattribute == NULL) | 527 | if (msg == NULL) |
516 | return EINVAL; | 528 | return EINVAL; |
517 | 529 | if (pattribute == NULL) | |
530 | return MU_ERR_OUT_PTR_NULL; | ||
518 | if (msg->attribute == NULL) | 531 | if (msg->attribute == NULL) |
519 | { | 532 | { |
520 | attribute_t attribute; | 533 | attribute_t attribute; | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -34,6 +34,7 @@ | ... | @@ -34,6 +34,7 @@ |
34 | #include <mailutils/stream.h> | 34 | #include <mailutils/stream.h> |
35 | #include <mailutils/body.h> | 35 | #include <mailutils/body.h> |
36 | #include <mailutils/header.h> | 36 | #include <mailutils/header.h> |
37 | #include <mailutils/errno.h> | ||
37 | #include <mime0.h> | 38 | #include <mime0.h> |
38 | 39 | ||
39 | #ifndef TRUE | 40 | #ifndef TRUE |
... | @@ -407,7 +408,7 @@ _mimepart_body_read (stream_t stream, char *buf, size_t buflen, off_t off, | ... | @@ -407,7 +408,7 @@ _mimepart_body_read (stream_t stream, char *buf, size_t buflen, off_t off, |
407 | int ret = 0; | 408 | int ret = 0; |
408 | 409 | ||
409 | if (nbytes == NULL) | 410 | if (nbytes == NULL) |
410 | return (EINVAL); | 411 | return MU_ERR_OUT_NULL; |
411 | 412 | ||
412 | *nbytes = 0; | 413 | *nbytes = 0; |
413 | read_len = (int) mime_part->len - (int) off; | 414 | read_len = (int) mime_part->len - (int) off; |
... | @@ -761,7 +762,7 @@ mime_create (mime_t * pmime, message_t msg, int flags) | ... | @@ -761,7 +762,7 @@ mime_create (mime_t * pmime, message_t msg, int flags) |
761 | } | 762 | } |
762 | else | 763 | else |
763 | { | 764 | { |
764 | if (ret == ENOENT) | 765 | if (ret == MU_ERR_NOENT) |
765 | { | 766 | { |
766 | ret = 0; | 767 | ret = 0; |
767 | if ((mime->content_type = | 768 | if ((mime->content_type = | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -33,7 +33,7 @@ | ... | @@ -33,7 +33,7 @@ |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | 34 | ||
35 | #include <monitor0.h> | 35 | #include <monitor0.h> |
36 | 36 | #include <mailutils/errno.h> | |
37 | 37 | ||
38 | #ifdef WITH_PTHREAD | 38 | #ifdef WITH_PTHREAD |
39 | pthread_mutex_t monitor_lock = PTHREAD_MUTEX_INITIALIZER; | 39 | pthread_mutex_t monitor_lock = PTHREAD_MUTEX_INITIALIZER; |
... | @@ -82,7 +82,7 @@ monitor_create (monitor_t *pmonitor, int flags, void *owner) | ... | @@ -82,7 +82,7 @@ monitor_create (monitor_t *pmonitor, int flags, void *owner) |
82 | monitor_t monitor; | 82 | monitor_t monitor; |
83 | 83 | ||
84 | if (pmonitor == NULL) | 84 | if (pmonitor == NULL) |
85 | return EINVAL; | 85 | return MU_ERR_OUT_PTR_NULL; |
86 | 86 | ||
87 | monitor = calloc (1, sizeof (*monitor)); | 87 | monitor = calloc (1, sizeof (*monitor)); |
88 | if (monitor == NULL) | 88 | if (monitor == NULL) | ... | ... |
... | @@ -47,6 +47,8 @@ | ... | @@ -47,6 +47,8 @@ |
47 | #include <mailutils/error.h> | 47 | #include <mailutils/error.h> |
48 | #include <mailutils/nls.h> | 48 | #include <mailutils/nls.h> |
49 | 49 | ||
50 | /* FIXME: The functions from this module assign values to errno and | ||
51 | use ENOENT instead of MU_ERR_NOENT */ | ||
50 | /*#define DEBUG(c) do { printf c; printf("\n"); } while (0)*/ | 52 | /*#define DEBUG(c) do { printf c; printf("\n"); } while (0)*/ |
51 | #define DEBUG(c) | 53 | #define DEBUG(c) |
52 | 54 | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
24 | 24 | ||
25 | #include <mailutils/list.h> | 25 | #include <mailutils/list.h> |
26 | #include <mailutils/iterator.h> | 26 | #include <mailutils/iterator.h> |
27 | 27 | #include <mailutils/errno.h> | |
28 | #include <observer0.h> | 28 | #include <observer0.h> |
29 | 29 | ||
30 | int | 30 | int |
... | @@ -110,7 +110,7 @@ observable_create (observable_t *pobservable, void *owner) | ... | @@ -110,7 +110,7 @@ observable_create (observable_t *pobservable, void *owner) |
110 | observable_t observable; | 110 | observable_t observable; |
111 | int status; | 111 | int status; |
112 | if (pobservable == NULL) | 112 | if (pobservable == NULL) |
113 | return EINVAL; | 113 | return MU_ERR_OUT_PTR_NULL; |
114 | observable = calloc (sizeof (*observable), 1); | 114 | observable = calloc (sizeof (*observable), 1); |
115 | if (observable == NULL) | 115 | if (observable == NULL) |
116 | return ENOMEM; | 116 | return ENOMEM; |
... | @@ -208,7 +208,7 @@ observable_detach (observable_t observable, observer_t observer) | ... | @@ -208,7 +208,7 @@ observable_detach (observable_t observable, observer_t observer) |
208 | free (event); | 208 | free (event); |
209 | } | 209 | } |
210 | else | 210 | else |
211 | status = ENOENT; | 211 | status = MU_ERR_NOENT; |
212 | return status; | 212 | return status; |
213 | } | 213 | } |
214 | 214 | ... | ... |
... | @@ -1305,7 +1305,7 @@ pop_message_size (message_t msg, size_t *psize) | ... | @@ -1305,7 +1305,7 @@ pop_message_size (message_t msg, size_t *psize) |
1305 | CLEAR_STATE (mpd); | 1305 | CLEAR_STATE (mpd); |
1306 | 1306 | ||
1307 | if (status != 2) | 1307 | if (status != 2) |
1308 | status = EINVAL; | 1308 | status = MU_ERR_PARSE; |
1309 | 1309 | ||
1310 | /* The size of the message is with the extra '\r' octet for everyline. | 1310 | /* The size of the message is with the extra '\r' octet for everyline. |
1311 | Substract to get, hopefully, a good count. */ | 1311 | Substract to get, hopefully, a good count. */ |
... | @@ -1535,7 +1535,7 @@ pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten) | ... | @@ -1535,7 +1535,7 @@ pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten) |
1535 | status = sscanf (mpd->buffer, "+OK %d %127s\n", &num, uniq); | 1535 | status = sscanf (mpd->buffer, "+OK %d %127s\n", &num, uniq); |
1536 | if (status != 2) | 1536 | if (status != 2) |
1537 | { | 1537 | { |
1538 | status = EINVAL; | 1538 | status = MU_ERR_PARSE; |
1539 | buflen = 0; | 1539 | buflen = 0; |
1540 | } | 1540 | } |
1541 | else | 1541 | else | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -36,8 +36,10 @@ mu_pop3_capa (mu_pop3_t pop3, list_t *plist) | ... | @@ -36,8 +36,10 @@ mu_pop3_capa (mu_pop3_t pop3, list_t *plist) |
36 | { | 36 | { |
37 | int status; | 37 | int status; |
38 | 38 | ||
39 | if (pop3 == NULL || plist == NULL) | 39 | if (pop3 == NULL) |
40 | return EINVAL; | 40 | return EINVAL; |
41 | if (plist == NULL) | ||
42 | return MU_ERR_OUT_PTR_NULL; | ||
41 | 43 | ||
42 | switch (pop3->state) | 44 | switch (pop3->state) |
43 | { | 45 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -45,8 +45,10 @@ int | ... | @@ -45,8 +45,10 @@ int |
45 | mu_pop3_get_carrier (mu_pop3_t pop3, stream_t *pcarrier) | 45 | mu_pop3_get_carrier (mu_pop3_t pop3, stream_t *pcarrier) |
46 | { | 46 | { |
47 | /* Sanity checks. */ | 47 | /* Sanity checks. */ |
48 | if (pop3 == NULL || pcarrier == NULL) | 48 | if (pop3 == NULL) |
49 | return EINVAL; | 49 | return EINVAL; |
50 | if (pcarrier == NULL) | ||
51 | return MU_ERR_OUT_PTR_NULL; | ||
50 | 52 | ||
51 | *pcarrier = pop3->carrier; | 53 | *pcarrier = pop3->carrier; |
52 | return 0; | 54 | return 0; | ... | ... |
... | @@ -29,8 +29,10 @@ mu_pop3_list (mu_pop3_t pop3, unsigned int msgno, size_t *psize) | ... | @@ -29,8 +29,10 @@ mu_pop3_list (mu_pop3_t pop3, unsigned int msgno, size_t *psize) |
29 | { | 29 | { |
30 | int status; | 30 | int status; |
31 | 31 | ||
32 | if (pop3 == NULL || msgno == 0 || psize == NULL) | 32 | if (pop3 == NULL || msgno == 0) |
33 | return EINVAL; | 33 | return EINVAL; |
34 | if (psize == NULL) | ||
35 | return MU_ERR_OUT_NULL; | ||
34 | 36 | ||
35 | switch (pop3->state) | 37 | switch (pop3->state) |
36 | { | 38 | { | ... | ... |
... | @@ -30,8 +30,10 @@ mu_pop3_list_all (mu_pop3_t pop3, list_t *plist) | ... | @@ -30,8 +30,10 @@ mu_pop3_list_all (mu_pop3_t pop3, list_t *plist) |
30 | { | 30 | { |
31 | int status; | 31 | int status; |
32 | 32 | ||
33 | if (pop3 == NULL || plist == NULL) | 33 | if (pop3 == NULL) |
34 | return EINVAL; | 34 | return EINVAL; |
35 | if (plist == NULL) | ||
36 | return MU_ERR_OUT_PTR_NULL; | ||
35 | 37 | ||
36 | switch (pop3->state) | 38 | switch (pop3->state) |
37 | { | 39 | { | ... | ... |
... | @@ -29,8 +29,10 @@ mu_pop3_retr (mu_pop3_t pop3, unsigned int msgno, stream_t *pstream) | ... | @@ -29,8 +29,10 @@ mu_pop3_retr (mu_pop3_t pop3, unsigned int msgno, stream_t *pstream) |
29 | { | 29 | { |
30 | int status; | 30 | int status; |
31 | 31 | ||
32 | if (pop3 == NULL || msgno == 0 || pstream == NULL) | 32 | if (pop3 == NULL || msgno == 0) |
33 | return EINVAL; | 33 | return EINVAL; |
34 | if (pstream == NULL) | ||
35 | return MU_ERR_OUT_PTR_NULL; | ||
34 | 36 | ||
35 | switch (pop3->state) | 37 | switch (pop3->state) |
36 | { | 38 | { | ... | ... |
... | @@ -28,8 +28,10 @@ mu_pop3_stat (mu_pop3_t pop3, unsigned *msg_count, size_t *size) | ... | @@ -28,8 +28,10 @@ mu_pop3_stat (mu_pop3_t pop3, unsigned *msg_count, size_t *size) |
28 | { | 28 | { |
29 | int status; | 29 | int status; |
30 | 30 | ||
31 | if (pop3 == NULL || msg_count == NULL || size == NULL) | 31 | if (pop3 == NULL || msg_count == NULL) |
32 | return EINVAL; | 32 | return EINVAL; |
33 | if (size == NULL) | ||
34 | return MU_ERR_OUT_PTR_NULL; | ||
33 | 35 | ||
34 | switch (pop3->state) | 36 | switch (pop3->state) |
35 | { | 37 | { | ... | ... |
... | @@ -38,8 +38,10 @@ int | ... | @@ -38,8 +38,10 @@ int |
38 | mu_pop3_get_timeout (mu_pop3_t pop3, int *ptimeout) | 38 | mu_pop3_get_timeout (mu_pop3_t pop3, int *ptimeout) |
39 | { | 39 | { |
40 | /* Sanity checks. */ | 40 | /* Sanity checks. */ |
41 | if (pop3 == NULL || ptimeout == NULL) | 41 | if (pop3 == NULL) |
42 | return EINVAL; | 42 | return EINVAL; |
43 | if (ptimeout == NULL) | ||
44 | return MU_ERR_OUT_PTR_NULL; | ||
43 | 45 | ||
44 | *ptimeout = pop3->timeout; | 46 | *ptimeout = pop3->timeout; |
45 | return 0; | 47 | return 0; | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -28,9 +28,10 @@ mu_pop3_top (mu_pop3_t pop3, unsigned msgno, unsigned int lines, stream_t *pstre | ... | @@ -28,9 +28,10 @@ mu_pop3_top (mu_pop3_t pop3, unsigned msgno, unsigned int lines, stream_t *pstre |
28 | { | 28 | { |
29 | int status; | 29 | int status; |
30 | 30 | ||
31 | if (pop3 == NULL || msgno == 0 || pstream == NULL) | 31 | if (pop3 == NULL || msgno == 0) |
32 | return EINVAL; | 32 | return EINVAL; |
33 | 33 | if (pstream == NULL) | |
34 | return MU_ERR_OUT_PTR_NULL; | ||
34 | 35 | ||
35 | switch (pop3->state) | 36 | switch (pop3->state) |
36 | { | 37 | { | ... | ... |
... | @@ -29,8 +29,10 @@ mu_pop3_uidl (mu_pop3_t pop3, unsigned int msgno, char **uidl) | ... | @@ -29,8 +29,10 @@ mu_pop3_uidl (mu_pop3_t pop3, unsigned int msgno, char **uidl) |
29 | { | 29 | { |
30 | int status; | 30 | int status; |
31 | 31 | ||
32 | if (pop3 == NULL || uidl == NULL) | 32 | if (pop3 == NULL) |
33 | return EINVAL; | 33 | return EINVAL; |
34 | if (uidl == NULL) | ||
35 | return MU_ERR_OUT_PTR_NULL; | ||
34 | 36 | ||
35 | switch (pop3->state) | 37 | switch (pop3->state) |
36 | { | 38 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -29,8 +29,10 @@ mu_pop3_uidl_all (mu_pop3_t pop3, list_t *plist) | ... | @@ -29,8 +29,10 @@ mu_pop3_uidl_all (mu_pop3_t pop3, list_t *plist) |
29 | { | 29 | { |
30 | int status; | 30 | int status; |
31 | 31 | ||
32 | if (pop3 == NULL || plist == NULL) | 32 | if (pop3 == NULL) |
33 | return EINVAL; | 33 | return EINVAL; |
34 | if (plist == NULL) | ||
35 | return MU_ERR_OUT_PTR_NULL; | ||
34 | 36 | ||
35 | switch (pop3->state) | 37 | switch (pop3->state) |
36 | { | 38 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
22 | # include <strings.h> | 22 | # include <strings.h> |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #include <mailutils/errno.h> | ||
25 | #include <property0.h> | 26 | #include <property0.h> |
26 | 27 | ||
27 | #undef min | 28 | #undef min |
... | @@ -35,7 +36,7 @@ property_create (property_t *pp, void *owner) | ... | @@ -35,7 +36,7 @@ property_create (property_t *pp, void *owner) |
35 | { | 36 | { |
36 | property_t prop; | 37 | property_t prop; |
37 | if (pp == NULL) | 38 | if (pp == NULL) |
38 | return EINVAL; | 39 | return MU_ERR_OUT_PTR_NULL; |
39 | prop = calloc (1, sizeof *prop); | 40 | prop = calloc (1, sizeof *prop); |
40 | if (prop == NULL) | 41 | if (prop == NULL) |
41 | return ENOMEM; | 42 | return ENOMEM; | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -31,7 +31,7 @@ mu_refcount_create (mu_refcount_t *prefcount) | ... | @@ -31,7 +31,7 @@ mu_refcount_create (mu_refcount_t *prefcount) |
31 | int status = 0; | 31 | int status = 0; |
32 | mu_refcount_t refcount; | 32 | mu_refcount_t refcount; |
33 | if (prefcount == NULL) | 33 | if (prefcount == NULL) |
34 | return EINVAL; | 34 | return MU_ERR_OUT_PTR_NULL; |
35 | refcount = calloc (1, sizeof *refcount); | 35 | refcount = calloc (1, sizeof *refcount); |
36 | if (refcount != NULL) | 36 | if (refcount != NULL) |
37 | { | 37 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -29,6 +29,7 @@ | ... | @@ -29,6 +29,7 @@ |
29 | #include <mailutils/iterator.h> | 29 | #include <mailutils/iterator.h> |
30 | #include <mailutils/list.h> | 30 | #include <mailutils/list.h> |
31 | #include <mailutils/monitor.h> | 31 | #include <mailutils/monitor.h> |
32 | #include <mailutils/errno.h> | ||
32 | 33 | ||
33 | #include <registrar0.h> | 34 | #include <registrar0.h> |
34 | 35 | ||
... | @@ -42,7 +43,7 @@ registrar_get_list (list_t *plist) | ... | @@ -42,7 +43,7 @@ registrar_get_list (list_t *plist) |
42 | { | 43 | { |
43 | int status = 0; | 44 | int status = 0; |
44 | if (plist == NULL) | 45 | if (plist == NULL) |
45 | return EINVAL; | 46 | return MU_ERR_OUT_PTR_NULL; |
46 | monitor_wrlock (®istrar_monitor); | 47 | monitor_wrlock (®istrar_monitor); |
47 | if (registrar_list == NULL) | 48 | if (registrar_list == NULL) |
48 | status = list_create (®istrar_list); | 49 | status = list_create (®istrar_list); |
... | @@ -108,8 +109,10 @@ record_set_is_scheme (record_t record, int (*_is_scheme) | ... | @@ -108,8 +109,10 @@ record_set_is_scheme (record_t record, int (*_is_scheme) |
108 | int | 109 | int |
109 | record_get_url (record_t record, int (*(*_purl)) __P ((url_t))) | 110 | record_get_url (record_t record, int (*(*_purl)) __P ((url_t))) |
110 | { | 111 | { |
111 | if (record == NULL || _purl == NULL) | 112 | if (record == NULL) |
112 | return EINVAL; | 113 | return EINVAL; |
114 | if (_purl == NULL) | ||
115 | return MU_ERR_OUT_PTR_NULL; | ||
113 | /* Overload. */ | 116 | /* Overload. */ |
114 | if (record->_get_url) | 117 | if (record->_get_url) |
115 | return record->_get_url (record, _purl); | 118 | return record->_get_url (record, _purl); |
... | @@ -139,8 +142,10 @@ record_set_get_url (record_t record, int (*_get_url) | ... | @@ -139,8 +142,10 @@ record_set_get_url (record_t record, int (*_get_url) |
139 | int | 142 | int |
140 | record_get_mailbox (record_t record, int (*(*_pmailbox)) __P ((mailbox_t))) | 143 | record_get_mailbox (record_t record, int (*(*_pmailbox)) __P ((mailbox_t))) |
141 | { | 144 | { |
142 | if (record == NULL || _pmailbox == NULL) | 145 | if (record == NULL) |
143 | return EINVAL; | 146 | return EINVAL; |
147 | if (_pmailbox == NULL) | ||
148 | return MU_ERR_OUT_PTR_NULL; | ||
144 | /* Overload. */ | 149 | /* Overload. */ |
145 | if (record->_get_mailbox) | 150 | if (record->_get_mailbox) |
146 | return record->_get_mailbox (record, _pmailbox); | 151 | return record->_get_mailbox (record, _pmailbox); |
... | @@ -170,8 +175,10 @@ record_set_get_mailbox (record_t record, int (*_get_mailbox) | ... | @@ -170,8 +175,10 @@ record_set_get_mailbox (record_t record, int (*_get_mailbox) |
170 | int | 175 | int |
171 | record_get_mailer (record_t record, int (*(*_pmailer)) __P ((mailer_t))) | 176 | record_get_mailer (record_t record, int (*(*_pmailer)) __P ((mailer_t))) |
172 | { | 177 | { |
173 | if (record == NULL || _pmailer == NULL) | 178 | if (record == NULL) |
174 | return EINVAL; | 179 | return EINVAL; |
180 | if (_pmailer == NULL) | ||
181 | return MU_ERR_OUT_PTR_NULL; | ||
175 | /* Overload. */ | 182 | /* Overload. */ |
176 | if (record->_get_mailer) | 183 | if (record->_get_mailer) |
177 | return record->_get_mailer (record, _pmailer); | 184 | return record->_get_mailer (record, _pmailer); |
... | @@ -201,8 +208,10 @@ record_set_get_mailer (record_t record, int (*_get_mailer) | ... | @@ -201,8 +208,10 @@ record_set_get_mailer (record_t record, int (*_get_mailer) |
201 | int | 208 | int |
202 | record_get_folder (record_t record, int (*(*_pfolder)) __P ((folder_t))) | 209 | record_get_folder (record_t record, int (*(*_pfolder)) __P ((folder_t))) |
203 | { | 210 | { |
204 | if (record == NULL || _pfolder == NULL) | 211 | if (record == NULL) |
205 | return EINVAL; | 212 | return EINVAL; |
213 | if (_pfolder == NULL) | ||
214 | return MU_ERR_OUT_PTR_NULL; | ||
206 | /* Overload. */ | 215 | /* Overload. */ |
207 | if (record->_get_folder) | 216 | if (record->_get_folder) |
208 | return record->_get_folder (record, _pfolder); | 217 | return record->_get_folder (record, _pfolder); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -38,8 +38,10 @@ rfc2047_decode (const char *tocode, const char *input, char **ptostr) | ... | @@ -38,8 +38,10 @@ rfc2047_decode (const char *tocode, const char *input, char **ptostr) |
38 | size_t bufpos; | 38 | size_t bufpos; |
39 | size_t run_count = 0; | 39 | size_t run_count = 0; |
40 | 40 | ||
41 | if (!tocode || !input || !ptostr) | 41 | if (!tocode || !input) |
42 | return EINVAL; | 42 | return EINVAL; |
43 | if (!ptostr) | ||
44 | return MU_ERR_OUT_PTR_NULL; | ||
43 | 45 | ||
44 | /* Prepare a temporary copy of the input string (strtok_r is | 46 | /* Prepare a temporary copy of the input string (strtok_r is |
45 | going to modify it. */ | 47 | going to modify it. */ |
... | @@ -605,10 +607,10 @@ rfc2047_encode (const char *charset, const char *encoding, | ... | @@ -605,10 +607,10 @@ rfc2047_encode (const char *charset, const char *encoding, |
605 | int is_compose; | 607 | int is_compose; |
606 | int state; | 608 | int state; |
607 | 609 | ||
608 | if (! charset || | 610 | if (!charset || !encoding || !text) |
609 | ! encoding || | 611 | return EINVAL; |
610 | ! text || | 612 | if (!result) |
611 | ! result) return EINVAL; | 613 | return MU_ERR_OUT_PTR_NULL; |
612 | 614 | ||
613 | /* Check for a known encoding */ | 615 | /* Check for a known encoding */ |
614 | do | 616 | do |
... | @@ -633,7 +635,7 @@ rfc2047_encode (const char *charset, const char *encoding, | ... | @@ -633,7 +635,7 @@ rfc2047_encode (const char *charset, const char *encoding, |
633 | break; | 635 | break; |
634 | } | 636 | } |
635 | 637 | ||
636 | return ENOENT; | 638 | return MU_ERR_NOENT; |
637 | } | 639 | } |
638 | while (0); | 640 | while (0); |
639 | 641 | ... | ... |
... | @@ -40,6 +40,7 @@ | ... | @@ -40,6 +40,7 @@ |
40 | #include <mailutils/url.h> | 40 | #include <mailutils/url.h> |
41 | #include <mailutils/header.h> | 41 | #include <mailutils/header.h> |
42 | #include <mailutils/body.h> | 42 | #include <mailutils/body.h> |
43 | #include <mailutils/errno.h> | ||
43 | 44 | ||
44 | #include <mailer0.h> | 45 | #include <mailer0.h> |
45 | #include <registrar0.h> | 46 | #include <registrar0.h> |
... | @@ -365,6 +366,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, | ... | @@ -365,6 +366,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, |
365 | header_t hdr; | 366 | header_t hdr; |
366 | body_t body; | 367 | body_t body; |
367 | int found_nl = 0; | 368 | int found_nl = 0; |
369 | int exit_status; | ||
368 | 370 | ||
369 | message_get_header (msg, &hdr); | 371 | message_get_header (msg, &hdr); |
370 | header_get_stream (hdr, &stream); | 372 | header_get_stream (hdr, &stream); |
... | @@ -430,7 +432,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, | ... | @@ -430,7 +432,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, |
430 | 432 | ||
431 | close (sendmail->fd); | 433 | close (sendmail->fd); |
432 | 434 | ||
433 | rc = waitpid (sendmail->pid, &status, 0); | 435 | rc = waitpid (sendmail->pid, &exit_status, 0); |
434 | 436 | ||
435 | if (rc < 0) | 437 | if (rc < 0) |
436 | { | 438 | { |
... | @@ -439,13 +441,19 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, | ... | @@ -439,13 +441,19 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, |
439 | "waitpid(%d) failed: %s\n", | 441 | "waitpid(%d) failed: %s\n", |
440 | sendmail->pid, strerror (status)); | 442 | sendmail->pid, strerror (status)); |
441 | } | 443 | } |
442 | else if (WIFEXITED (status)) | 444 | else if (WIFEXITED (exit_status)) |
443 | { | 445 | { |
444 | status = WEXITSTATUS (status); | 446 | exit_status = WEXITSTATUS (exit_status); |
445 | MAILER_DEBUG2 (mailer, MU_DEBUG_TRACE, | 447 | MAILER_DEBUG2 (mailer, MU_DEBUG_TRACE, |
446 | "%s exited with: %s\n", | 448 | "%s exited with: %d\n", |
447 | sendmail->path, strerror (status)); | 449 | sendmail->path, exit_status); |
450 | status = (exit_status == 0) ? 0 : MU_ERR_PROCESS_EXITED; | ||
448 | } | 451 | } |
452 | else if (WIFSIGNALED (exit_status)) | ||
453 | status = MU_ERR_PROCESS_SIGNALED; | ||
454 | else | ||
455 | status = MU_ERR_PROCESS_UNKNOWN_FAILURE; | ||
456 | |||
449 | /* Shouldn't this notification only happen on success? */ | 457 | /* Shouldn't this notification only happen on success? */ |
450 | observable_notify (mailer->observable, MU_EVT_MAILER_MESSAGE_SENT); | 458 | observable_notify (mailer->observable, MU_EVT_MAILER_MESSAGE_SENT); |
451 | } | 459 | } |
... | @@ -453,7 +461,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, | ... | @@ -453,7 +461,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, |
453 | break; | 461 | break; |
454 | } | 462 | } |
455 | 463 | ||
456 | sendmail->state = SENDMAIL_OPEN; | 464 | sendmail->state = (status == 0) ? SENDMAIL_OPEN : SENDMAIL_CLOSED; |
457 | 465 | ||
458 | return status; | 466 | return status; |
459 | } | 467 | } | ... | ... |
... | @@ -500,8 +500,8 @@ message_has_bcc (message_t msg) | ... | @@ -500,8 +500,8 @@ message_has_bcc (message_t msg) |
500 | 500 | ||
501 | status = header_get_value (header, MU_HEADER_BCC, NULL, 0, &bccsz); | 501 | status = header_get_value (header, MU_HEADER_BCC, NULL, 0, &bccsz); |
502 | 502 | ||
503 | /* ENOENT, or there was a Bcc: field. */ | 503 | /* MU_ERR_NOENT, or there was a Bcc: field. */ |
504 | return status == ENOENT ? 0 : 1; | 504 | return status == MU_ERR_NOENT ? 0 : 1; |
505 | } | 505 | } |
506 | 506 | ||
507 | /* | 507 | /* |
... | @@ -874,7 +874,7 @@ _smtp_set_from (smtp_t smtp, message_t msg, address_t from) | ... | @@ -874,7 +874,7 @@ _smtp_set_from (smtp_t smtp, message_t msg, address_t from) |
874 | } | 874 | } |
875 | break; | 875 | break; |
876 | 876 | ||
877 | case ENOENT: | 877 | case MU_ERR_NOENT: |
878 | /* Use the environment. */ | 878 | /* Use the environment. */ |
879 | mail_from = mu_get_user_email (NULL); | 879 | mail_from = mu_get_user_email (NULL); |
880 | 880 | ||
... | @@ -969,7 +969,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to) | ... | @@ -969,7 +969,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to) |
969 | smtp_address_add (&smtp->rcpt_to, value); | 969 | smtp_address_add (&smtp->rcpt_to, value); |
970 | free (value); | 970 | free (value); |
971 | } | 971 | } |
972 | else if (status != ENOENT) | 972 | else if (status != MU_ERR_NOENT) |
973 | goto end; | 973 | goto end; |
974 | 974 | ||
975 | status = header_aget_value (header, MU_HEADER_CC, &value); | 975 | status = header_aget_value (header, MU_HEADER_CC, &value); |
... | @@ -979,7 +979,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to) | ... | @@ -979,7 +979,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to) |
979 | smtp_address_add (&smtp->rcpt_to, value); | 979 | smtp_address_add (&smtp->rcpt_to, value); |
980 | free (value); | 980 | free (value); |
981 | } | 981 | } |
982 | else if (status != ENOENT) | 982 | else if (status != MU_ERR_NOENT) |
983 | goto end; | 983 | goto end; |
984 | 984 | ||
985 | status = header_aget_value (header, MU_HEADER_BCC, &value); | 985 | status = header_aget_value (header, MU_HEADER_BCC, &value); |
... | @@ -988,7 +988,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to) | ... | @@ -988,7 +988,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to) |
988 | smtp_address_add (&smtp->rcpt_bcc, value); | 988 | smtp_address_add (&smtp->rcpt_bcc, value); |
989 | free (value); | 989 | free (value); |
990 | } | 990 | } |
991 | else if (status != ENOENT) | 991 | else if (status != MU_ERR_NOENT) |
992 | goto end; | 992 | goto end; |
993 | 993 | ||
994 | /* If to or bcc is present, the must be OK. */ | 994 | /* If to or bcc is present, the must be OK. */ | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -36,7 +36,7 @@ | ... | @@ -36,7 +36,7 @@ |
36 | #include <string.h> | 36 | #include <string.h> |
37 | 37 | ||
38 | #include <mailutils/property.h> | 38 | #include <mailutils/property.h> |
39 | 39 | #include <mailutils/errno.h> | |
40 | #include <stream0.h> | 40 | #include <stream0.h> |
41 | 41 | ||
42 | static int refill (stream_t, off_t); | 42 | static int refill (stream_t, off_t); |
... | @@ -52,7 +52,9 @@ int | ... | @@ -52,7 +52,9 @@ int |
52 | stream_create (stream_t *pstream, int flags, void *owner) | 52 | stream_create (stream_t *pstream, int flags, void *owner) |
53 | { | 53 | { |
54 | stream_t stream; | 54 | stream_t stream; |
55 | if (pstream == NULL || owner == NULL) | 55 | if (pstream == NULL) |
56 | return MU_ERR_OUT_PTR_NULL; | ||
57 | if (owner == NULL) | ||
56 | return EINVAL; | 58 | return EINVAL; |
57 | stream = calloc (1, sizeof (*stream)); | 59 | stream = calloc (1, sizeof (*stream)); |
58 | if (stream == NULL) | 60 | if (stream == NULL) |
... | @@ -441,8 +443,10 @@ stream_get_fd2 (stream_t stream, int *pfd1, int *pfd2) | ... | @@ -441,8 +443,10 @@ stream_get_fd2 (stream_t stream, int *pfd1, int *pfd2) |
441 | int | 443 | int |
442 | stream_get_flags (stream_t stream, int *pfl) | 444 | stream_get_flags (stream_t stream, int *pfl) |
443 | { | 445 | { |
444 | if (stream == NULL || pfl == NULL ) | 446 | if (stream == NULL) |
445 | return EINVAL; | 447 | return EINVAL; |
448 | if (pfl == NULL) | ||
449 | return MU_ERR_OUT_NULL; | ||
446 | *pfl = stream->flags; | 450 | *pfl = stream->flags; |
447 | return 0; | 451 | return 0; |
448 | } | 452 | } |
... | @@ -505,8 +509,10 @@ stream_flush (stream_t stream) | ... | @@ -505,8 +509,10 @@ stream_flush (stream_t stream) |
505 | int | 509 | int |
506 | stream_get_state (stream_t stream, int *pstate) | 510 | stream_get_state (stream_t stream, int *pstate) |
507 | { | 511 | { |
508 | if (stream == NULL || pstate == NULL) | 512 | if (stream == NULL) |
509 | return EINVAL; | 513 | return EINVAL; |
514 | if (pstate == NULL) | ||
515 | return MU_ERR_OUT_PTR_NULL; | ||
510 | *pstate = stream->state; | 516 | *pstate = stream->state; |
511 | return 0; | 517 | return 0; |
512 | } | 518 | } | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -154,7 +154,9 @@ _tcp_get_fd (stream_t stream, int *fd, int *fd2) | ... | @@ -154,7 +154,9 @@ _tcp_get_fd (stream_t stream, int *fd, int *fd2) |
154 | { | 154 | { |
155 | struct _tcp_instance *tcp = stream_get_owner (stream); | 155 | struct _tcp_instance *tcp = stream_get_owner (stream); |
156 | 156 | ||
157 | if (fd == NULL || tcp->fd == -1) | 157 | if (fd == NULL) |
158 | return MU_ERR_OUT_PTR_NULL; | ||
159 | if (tcp->fd == -1) | ||
158 | return EINVAL; | 160 | return EINVAL; |
159 | if (fd2) | 161 | if (fd2) |
160 | return ENOSYS; | 162 | return ENOSYS; |
... | @@ -171,7 +173,7 @@ _tcp_read (stream_t stream, char *buf, size_t buf_size, off_t offset, size_t * b | ... | @@ -171,7 +173,7 @@ _tcp_read (stream_t stream, char *buf, size_t buf_size, off_t offset, size_t * b |
171 | 173 | ||
172 | offset = offset; | 174 | offset = offset; |
173 | if (br == NULL) | 175 | if (br == NULL) |
174 | return EINVAL; | 176 | return MU_ERR_OUT_NULL; |
175 | *br = 0; | 177 | *br = 0; |
176 | if ((bytes = recv (tcp->fd, buf, buf_size, 0)) == -1) | 178 | if ((bytes = recv (tcp->fd, buf, buf_size, 0)) == -1) |
177 | { | 179 | { |
... | @@ -191,7 +193,7 @@ _tcp_write (stream_t stream, const char *buf, size_t buf_size, off_t offset, | ... | @@ -191,7 +193,7 @@ _tcp_write (stream_t stream, const char *buf, size_t buf_size, off_t offset, |
191 | 193 | ||
192 | offset = offset; | 194 | offset = offset; |
193 | if (bw == NULL) | 195 | if (bw == NULL) |
194 | return EINVAL; | 196 | return MU_ERR_OUT_NULL; |
195 | *bw = 0; | 197 | *bw = 0; |
196 | if ((bytes = send (tcp->fd, buf, buf_size, 0)) == -1) | 198 | if ((bytes = send (tcp->fd, buf, buf_size, 0)) == -1) |
197 | { | 199 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -28,6 +28,7 @@ | ... | @@ -28,6 +28,7 @@ |
28 | #include <termios.h> | 28 | #include <termios.h> |
29 | 29 | ||
30 | #include <mailutils/mutil.h> | 30 | #include <mailutils/mutil.h> |
31 | #include <mailutils/errno.h> | ||
31 | #include <auth0.h> | 32 | #include <auth0.h> |
32 | 33 | ||
33 | static void | 34 | static void |
... | @@ -51,7 +52,7 @@ ticket_create (ticket_t *pticket, void *owner) | ... | @@ -51,7 +52,7 @@ ticket_create (ticket_t *pticket, void *owner) |
51 | { | 52 | { |
52 | ticket_t ticket; | 53 | ticket_t ticket; |
53 | if (pticket == NULL) | 54 | if (pticket == NULL) |
54 | return EINVAL; | 55 | return MU_ERR_OUT_PTR_NULL; |
55 | ticket = calloc (1, sizeof (*ticket)); | 56 | ticket = calloc (1, sizeof (*ticket)); |
56 | if (ticket == NULL) | 57 | if (ticket == NULL) |
57 | return ENOMEM; | 58 | return ENOMEM; |
... | @@ -114,8 +115,10 @@ ticket_pop (ticket_t ticket, url_t url, const char *challenge, char **parg) | ... | @@ -114,8 +115,10 @@ ticket_pop (ticket_t ticket, url_t url, const char *challenge, char **parg) |
114 | { | 115 | { |
115 | int rc = -1; | 116 | int rc = -1; |
116 | 117 | ||
117 | if (ticket == NULL || parg == NULL) | 118 | if (ticket == NULL) |
118 | return EINVAL; | 119 | return EINVAL; |
120 | if (parg == NULL) | ||
121 | return MU_ERR_OUT_PTR_NULL; | ||
119 | if (ticket->_pop) | 122 | if (ticket->_pop) |
120 | rc = ticket->_pop (ticket, url, challenge, parg); | 123 | rc = ticket->_pop (ticket, url, challenge, parg); |
121 | if (rc != 0 && isatty (fileno (stdin))) | 124 | if (rc != 0 && isatty (fileno (stdin))) |
... | @@ -149,8 +152,10 @@ ticket_pop (ticket_t ticket, url_t url, const char *challenge, char **parg) | ... | @@ -149,8 +152,10 @@ ticket_pop (ticket_t ticket, url_t url, const char *challenge, char **parg) |
149 | int | 152 | int |
150 | ticket_get_data (ticket_t ticket, void **data) | 153 | ticket_get_data (ticket_t ticket, void **data) |
151 | { | 154 | { |
152 | if (ticket == NULL || data == NULL) | 155 | if (ticket == NULL) |
153 | return EINVAL; | 156 | return EINVAL; |
157 | if (data == NULL) | ||
158 | return MU_ERR_OUT_PTR_NULL; | ||
154 | *data = ticket->data; | 159 | *data = ticket->data; |
155 | return 0; | 160 | return 0; |
156 | } | 161 | } | ... | ... |
... | @@ -28,13 +28,9 @@ | ... | @@ -28,13 +28,9 @@ |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include <mailutils/mutil.h> | 30 | #include <mailutils/mutil.h> |
31 | 31 | #include <mailutils/errno.h> | |
32 | #include <url0.h> | 32 | #include <url0.h> |
33 | 33 | ||
34 | #ifndef EPARSE | ||
35 | # define EPARSE ENOENT | ||
36 | #endif | ||
37 | |||
38 | /* | 34 | /* |
39 | TODO: implement functions to create a url and encode it properly. | 35 | TODO: implement functions to create a url and encode it properly. |
40 | */ | 36 | */ |
... | @@ -201,7 +197,7 @@ url_parse0 (url_t u, char *name) | ... | @@ -201,7 +197,7 @@ url_parse0 (url_t u, char *name) |
201 | p = strchr (name, ':'); | 197 | p = strchr (name, ':'); |
202 | if (p == NULL) | 198 | if (p == NULL) |
203 | { | 199 | { |
204 | return EPARSE; | 200 | return MU_ERR_PARSE; |
205 | } | 201 | } |
206 | 202 | ||
207 | *p++ = 0; | 203 | *p++ = 0; |
... | @@ -280,7 +276,7 @@ url_parse0 (url_t u, char *name) | ... | @@ -280,7 +276,7 @@ url_parse0 (url_t u, char *name) |
280 | /* Check for garbage after the port: we should be on the start | 276 | /* Check for garbage after the port: we should be on the start |
281 | of a path, a query, or at the end of the string. */ | 277 | of a path, a query, or at the end of the string. */ |
282 | if (*p && strcspn (p, "/?") != 0) | 278 | if (*p && strcspn (p, "/?") != 0) |
283 | return EPARSE; | 279 | return MU_ERR_PARSE; |
284 | } | 280 | } |
285 | else | 281 | else |
286 | p = u->host + strcspn (u->host, "/?"); | 282 | p = u->host + strcspn (u->host, "/?"); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -55,7 +55,7 @@ wicket_create (wicket_t *pwicket, const char *filename) | ... | @@ -55,7 +55,7 @@ wicket_create (wicket_t *pwicket, const char *filename) |
55 | struct stat st; | 55 | struct stat st; |
56 | 56 | ||
57 | if (pwicket == NULL) | 57 | if (pwicket == NULL) |
58 | return EINVAL; | 58 | return MU_ERR_OUT_PTR_NULL; |
59 | 59 | ||
60 | if (filename) | 60 | if (filename) |
61 | { | 61 | { | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | 4 | GNU Mailutils is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -49,7 +49,7 @@ mh_context_read (mh_context_t *ctx) | ... | @@ -49,7 +49,7 @@ mh_context_read (mh_context_t *ctx) |
49 | FILE *fp; | 49 | FILE *fp; |
50 | 50 | ||
51 | if (!ctx) | 51 | if (!ctx) |
52 | return EINVAL; | 52 | return MU_ERR_OUT_NULL; |
53 | 53 | ||
54 | if (stat (ctx->name, &st)) | 54 | if (stat (ctx->name, &st)) |
55 | return errno; | 55 | return errno; |
... | @@ -83,14 +83,14 @@ mh_context_write (mh_context_t *ctx) | ... | @@ -83,14 +83,14 @@ mh_context_write (mh_context_t *ctx) |
83 | FILE *fp; | 83 | FILE *fp; |
84 | 84 | ||
85 | if (!ctx) | 85 | if (!ctx) |
86 | return EINVAL; | 86 | return MU_ERR_OUT_NULL; |
87 | 87 | ||
88 | fp = fopen (ctx->name, "w"); | 88 | fp = fopen (ctx->name, "w"); |
89 | if (!fp) | 89 | if (!fp) |
90 | { | 90 | { |
91 | mh_error (_("can't write context file %s: %s"), | 91 | mh_error (_("can't write context file %s: %s"), |
92 | ctx->name, strerror (errno)); | 92 | ctx->name, strerror (errno)); |
93 | return 1; | 93 | return MU_ERR_FAILURE; |
94 | } | 94 | } |
95 | 95 | ||
96 | header_get_stream (ctx->header, &stream); | 96 | header_get_stream (ctx->header, &stream); | ... | ... |
-
Please register or sign in to post a comment