diff options
32 files changed, 404 insertions, 255 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 702e7378c9..a7490409c5 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,101 @@ +2002-11-11 Jeffrey Stedfast <fejj@ximian.com> + + * providers/local/camel-spool-summary.c (spool_summary_sync_full): + Use g_strerror when setting an exception string (we need it to be + in UTF-8). + (spool_summary_check): Here too. + + * providers/local/camel-spool-store.c (construct): Use g_strerror + when setting an exception string (we need it to be in UTF-8). + (get_folder): Same. + (scan_dir): Here too. + + * providers/local/camel-spool-folder.c (spool_lock): Use + g_strerror when setting an exception string (we need it to be in + UTF-8). + + * providers/local/camel-mh-summary.c (mh_summary_check): Use + g_strerror when setting an exception string (we need it to be in + UTF-8). + + * providers/local/camel-mh-store.c (delete_folder): Use g_strerror + when setting an exception string (we need it to be in UTF-8). + + * providers/local/camel-mbox-summary.c (summary_update): Use + g_strerror when setting an exception string (we need it to be in + UTF-8). + (mbox_summary_sync_full): Here too. + (mbox_summary_sync_quick): Same. + (mbox_summary_sync): Also here. + (camel_mbox_summary_sync_mbox): Again here. + + * providers/local/camel-mbox-folder.c (mbox_lock): Use g_strerror + when setting an exception string (we need it to be in UTF-8). + (mbox_append_message): Same. + (mbox_get_message): Here too. + + * providers/local/camel-maildir-summary.c (maildir_summary_load): + Use g_strerror when setting an exception string (we need it to be + in UTF-8). + (maildir_summary_check): Same. + + * providers/local/camel-maildir-store.c (get_folder): Use + g_strerror when setting an exception string (we need it to be in + UTF-8). + (delete_folder): Same. + (delete_folder): Here too. + + * providers/local/camel-local-summary.c (local_summary_sync): Use + g_strerror when setting an exception string (we need it to be in + UTF-8). + + * providers/local/camel-local-store.c (get_folder): Use g_strerror + when setting an exception string (we need it to be in UTF-8). + (create_folder): Same. + (xrename): Here too. + (rename_folder): And here. + (delete_folder): Also here. + + * camel-provider.c (camel_provider_init): For debugging printfs, + we want to use normal strerror (we want locale charset, not + UTF-8). + + * camel-movemail.c (camel_movemail): Use g_strerror when setting + an exception string (we need it to be in UTF-8). + (movemail_external): Same. + (camel_movemail_copy_file): Here too. + (camel_movemail_solaris): Also here. + + * camel-mime-utils.c (rfc2047_decode_word): For debugging printfs, + we want to use normal strerror (we want locale charset, not + UTF-8). + (header_encode_param): Same. + + * camel-mime-part-utils.c (convert_buffer): For debugging printfs, + we want to use normal strerror (we want locale charset, not + UTF-8). + + * camel-lock-client.c (camel_lock_helper_init): Use g_strerror + when setting an exception string (we need it to be in UTF-8). + + * camel-data-cache.c (camel_data_cache_remove): Use g_strerror + when setting an exception string (we need it to be in UTF-8). + + * camel-tcp-stream-raw.c (flaky_tcp_write): For debugging printfs, + we want to use normal strerror (we want locale charset, not + UTF-8). + (flaky_tcp_read): Same. + + * camel-gpg-context.c (gpg_ctx_op_step): For debugging printfs, we + want to use normal strerror (we want locale charset, not UTF-8). + + * camel-service.c (camel_gethostbyname): Use g_strerror when + setting an exception string (we need it to be in UTF-8). + + * camel-lock.c (camel_lock_dot): Use g_strerror when setting an + exception string (we need it to be in UTF-8). + (camel_lock_fcntl): Same. + 2002-11-07 Not Zed <NotZed@Ximian.com> * camel-mime-part.c (camel_mime_part_set_content_type): constify diff --git a/camel/camel-data-cache.c b/camel/camel-data-cache.c index 04c9650bdb..6147a888f1 100644 --- a/camel/camel-data-cache.c +++ b/camel/camel-data-cache.c @@ -438,10 +438,10 @@ camel_data_cache_remove(CamelDataCache *cdc, const char *path, const char *key, } /* maybe we were a mem stream */ - if (unlink(real) == -1 && errno != ENOENT) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not remove cache entry: %s: %s"), - real, strerror(errno)); + if (unlink (real) == -1 && errno != ENOENT) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not remove cache entry: %s: %s"), + real, g_strerror (errno)); ret = -1; } else { ret = 0; diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index b68e8995c4..337342acd6 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -589,9 +589,9 @@ camel_folder_summary_load(CamelFolderSummary *s) return 0; error: - g_warning("Cannot load summary file: %s", strerror(ferror(in))); + g_warning ("Cannot load summary file: %s", strerror (ferror (in))); CAMEL_SUMMARY_UNLOCK(s, io_lock); - fclose(in); + fclose (in); s->flags |= ~CAMEL_SUMMARY_DIRTY; return -1; diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c index 929e8f1769..72bda72990 100644 --- a/camel/camel-gpg-context.c +++ b/camel/camel-gpg-context.c @@ -954,7 +954,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex) if (errno == EINTR) goto retry; - d(printf ("select() failed: %s\n", g_strerror (errno))); + d(printf ("select() failed: %s\n", strerror (errno))); return -1; } diff --git a/camel/camel-index-control.c b/camel/camel-index-control.c index 335f8cc3b1..e5dfe1dbdf 100644 --- a/camel/camel-index-control.c +++ b/camel/camel-index-control.c @@ -53,7 +53,7 @@ do_compress(int argc, char **argv) } camel_object_unref((CamelObject *)idx); } else { - printf(" Failed: %s\n", strerror(errno)); + printf(" Failed: %s\n", strerror (errno)); return 1; } } @@ -74,7 +74,7 @@ do_dump(int argc, char **argv) camel_text_index_dump((CamelTextIndex *)idx); camel_object_unref((CamelObject *)idx); } else { - printf(" Failed: %s\n", strerror(errno)); + printf(" Failed: %s\n", strerror (errno)); return 1; } } @@ -94,7 +94,7 @@ do_info(int argc, char **argv) camel_text_index_info((CamelTextIndex *)idx); camel_object_unref((CamelObject *)idx); } else { - printf(" Failed: %s\n", strerror(errno)); + printf(" Failed: %s\n", strerror (errno)); return 0; } } @@ -114,7 +114,7 @@ do_check(int argc, char **argv) camel_text_index_validate((CamelTextIndex *)idx); camel_object_unref((CamelObject *)idx); } else { - printf(" Failed: %s\n", strerror(errno)); + printf(" Failed: %s\n", strerror (errno)); return 0; } } diff --git a/camel/camel-lock-client.c b/camel/camel-lock-client.c index fbbed82192..99c8fd8329 100644 --- a/camel/camel-lock-client.c +++ b/camel/camel-lock-client.c @@ -107,9 +107,9 @@ static int camel_lock_helper_init(CamelException *ex) if (pipe(lock_stdin_pipe) == -1 || pipe(lock_stdout_pipe) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot build locking helper pipe: %s"), - strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot build locking helper pipe: %s"), + g_strerror (errno)); return -1; } @@ -120,9 +120,9 @@ static int camel_lock_helper_init(CamelException *ex) close(lock_stdin_pipe[1]); close(lock_stdout_pipe[0]); close(lock_stdout_pipe[1]); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot fork locking helper: %s"), - strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot fork locking helper: %s"), + g_strerror (errno)); return -1; case 0: close(STDIN_FILENO); diff --git a/camel/camel-lock.c b/camel/camel-lock.c index ee613ce7be..dd52daa882 100644 --- a/camel/camel-lock.c +++ b/camel/camel-lock.c @@ -88,7 +88,9 @@ camel_lock_dot(const char *path, CamelException *ex) sprintf(locktmp, "%sXXXXXX", path); if (mktemp(locktmp) == NULL) { /* well, this is really only a programatic error */ - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create lock file for %s: %s"), path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not create lock file for %s: %s"), + path, g_strerror (errno)); return -1; } #endif @@ -107,7 +109,9 @@ camel_lock_dot(const char *path, CamelException *ex) fdtmp = open(locktmp, O_RDWR|O_CREAT|O_EXCL, 0600); #endif if (fdtmp == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create lock file for %s: %s"), path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not create lock file for %s: %s"), + path, g_strerror (errno)); return -1; } close(fdtmp); @@ -201,8 +205,9 @@ camel_lock_fcntl(int fd, CamelLockType type, CamelException *ex) we assume the filesystem doesn't support fcntl() locking */ /* this is somewhat system-dependent */ if (errno != EINVAL && errno != ENOLCK) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to get lock using fcntl(2): %s"), - strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Failed to get lock using fcntl(2): %s"), + g_strerror (errno)); return -1; } else { static int failed = 0; @@ -263,7 +268,9 @@ camel_lock_flock(int fd, CamelLockType type, CamelException *ex) op = LOCK_EX|LOCK_NB; if (flock(fd, op) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to get lock using flock(2): %s"), strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Failed to get lock using flock(2): %s"), + g_strerror (errno)); return -1; } #endif diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c index 28c4af4db4..f8eafa9633 100644 --- a/camel/camel-mime-filter-charset.c +++ b/camel/camel-mime-filter-charset.c @@ -259,7 +259,7 @@ camel_mime_filter_charset_new_convert (const char *from_charset, const char *to_ new->ic = e_iconv_open (to_charset, from_charset); if (new->ic == (iconv_t) -1) { - g_warning("Cannot create charset conversion from %s to %s: %s", from_charset, to_charset, strerror(errno)); + g_warning ("Cannot create charset conversion from %s to %s: %s", from_charset, to_charset, strerror (errno)); camel_object_unref ((CamelObject *)new); new = NULL; } else { diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 6269e9391c..c7ee07f070 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -120,7 +120,7 @@ convert_buffer (GByteArray *in, const char *to, const char *from) cd = e_iconv_open(to, from); if (cd == (iconv_t) -1) { - g_warning ("Cannot convert from '%s' to '%s': %s", from, to, g_strerror (errno)); + g_warning ("Cannot convert from '%s' to '%s': %s", from, to, strerror (errno)); return NULL; } @@ -179,7 +179,7 @@ convert_buffer (GByteArray *in, const char *to, const char *from) return out; fail: - g_warning ("Cannot convert from '%s' to '%s': %s", from, to, g_strerror (errno)); + g_warning ("Cannot convert from '%s' to '%s': %s", from, to, strerror (errno)); g_byte_array_free (out, TRUE); diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 85ccf383f1..8c81074e5b 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -1071,7 +1071,7 @@ rfc2047_decode_word(const char *in, size_t len) e_iconv_close (ic); } else { w(g_warning ("Cannot decode charset, header display may be corrupt: %s: %s", - charset, g_strerror (errno))); + charset, strerror (errno))); if (!retried) { charset = e_iconv_locale_charset (); @@ -1130,7 +1130,7 @@ append_8bit (GString *out, const char *inbuf, size_t inlen, const char *charset) outbuf = outbase = g_malloc(outlen); if (e_iconv(ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) { - w(g_warning("Conversion to '%s' failed: %s", charset, strerror(errno))); + w(g_warning("Conversion to '%s' failed: %s", charset, strerror (errno))); g_free(outbase); e_iconv_close(ic); return FALSE; @@ -1282,7 +1282,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char * convlen = MIN(inlen, CAMEL_FOLD_PREENCODED); p = inptr; if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1) { - w(g_warning("Conversion problem: conversion truncated: %s", strerror(errno))); + w(g_warning("Conversion problem: conversion truncated: %s", strerror (errno))); /* blah, we include it anyway, better than infinite loop ... */ inptr = p + convlen; } else { @@ -2987,7 +2987,7 @@ header_encode_param (const unsigned char *in, gboolean *encoded) inbuf = in; if (e_iconv (cd, &inbuf, &inleft, &outptr, &outleft) == (size_t) -1) { - w(g_warning ("Conversion problem: conversion truncated: %s", g_strerror (errno))); + w(g_warning ("Conversion problem: conversion truncated: %s", strerror (errno))); } else { e_iconv (cd, NULL, 0, &outptr, &outleft); } diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c index c4f22b6332..b5a287cfa6 100644 --- a/camel/camel-movemail.c +++ b/camel/camel-movemail.c @@ -104,9 +104,8 @@ camel_movemail(const char *source, const char *dest, CamelException *ex) if (stat (source, &st) == -1) { if (errno != ENOENT) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not check mail file " - "%s: %s"), source, - strerror (errno)); + _("Could not check mail file %s: %s"), + source, g_strerror (errno)); } return -1; } @@ -119,7 +118,7 @@ camel_movemail(const char *source, const char *dest, CamelException *ex) if (sfd == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not open mail file %s: %s"), - source, strerror (errno)); + source, g_strerror (errno)); return -1; } @@ -128,7 +127,7 @@ camel_movemail(const char *source, const char *dest, CamelException *ex) camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not open temporary mail " "file %s: %s"), dest, - strerror (errno)); + g_strerror (errno)); close (sfd); return -1; } @@ -155,8 +154,8 @@ camel_movemail(const char *source, const char *dest, CamelException *ex) ftruncate (sfd, 0); } else { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to store mail in temp file %s: %s"), dest, - strerror(errno)); + _("Failed to store mail in temp file %s: %s"), + dest, g_strerror (errno)); res = -1; } } else @@ -186,7 +185,7 @@ movemail_external (const char *source, const char *dest, CamelException *ex) sigprocmask (SIG_SETMASK, &omask, NULL); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create pipe: %s"), - strerror (errno)); + g_strerror (errno)); return; } @@ -198,7 +197,7 @@ movemail_external (const char *source, const char *dest, CamelException *ex) sigprocmask (SIG_SETMASK, &omask, NULL); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not fork: %s"), - strerror (errno)); + g_strerror (errno)); return; case 0: @@ -260,7 +259,7 @@ camel_movemail_copy_file(int sfd, int dfd, CamelException *ex) continue; camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Error reading mail file: %s"), - strerror (errno)); + g_strerror (errno)); return -1; } @@ -271,7 +270,7 @@ camel_movemail_copy_file(int sfd, int dfd, CamelException *ex) continue; /* continues inner loop */ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Error writing mail temp file: %s"), - strerror (errno)); + g_strerror (errno)); return -1; } written += nwrote; @@ -464,7 +463,7 @@ camel_movemail_solaris (int oldsfd, int dfd, CamelException *ex) if (sfd == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Error copying mail temp file: %s"), - strerror (errno)); + g_strerror (errno)); return -1; } @@ -531,7 +530,7 @@ fail: camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Error copying mail temp file: %s"), - strerror (errno)); + g_strerror (errno)); camel_object_unref((CamelObject *)mp); diff --git a/camel/camel-provider.c b/camel/camel-provider.c index 24c7be218f..0d096a9f33 100644 --- a/camel/camel-provider.c +++ b/camel/camel-provider.c @@ -67,26 +67,26 @@ camel_provider_init (void) char *p, *name, buf[80]; providers = g_hash_table_new (g_strcase_hash, g_strcase_equal); - + dir = opendir (CAMEL_PROVIDERDIR); if (!dir) { g_error ("Could not open camel provider directory: %s", - g_strerror (errno)); + strerror (errno)); return NULL; } - + while ((d = readdir (dir))) { FILE *fp; p = strchr (d->d_name, '.'); if (!p || strcmp (p, ".urls") != 0) continue; - + name = g_strdup_printf ("%s/%s", CAMEL_PROVIDERDIR, d->d_name); fp = fopen (name, "r"); if (!fp) { g_warning ("Could not read provider info file %s: %s", - name, g_strerror (errno)); + name, strerror (errno)); g_free (name); continue; } diff --git a/camel/camel-service.c b/camel/camel-service.c index da52d66252..8c3b3fc62f 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -771,7 +771,9 @@ camel_gethostbyname (const char *name, CamelException *ex) } while (status == -1 && errno == EINTR); if (status == -1) { - camel_exception_setv(ex, 1, _("Failure in name lookup: %s"), strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Failure in name lookup: %s"), + g_strerror (errno)); d(printf("Cancelling lookup thread\n")); pthread_cancel(id); } else if (FD_ISSET(cancel_fd, &rdset)) { diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c index 1eb931820f..87a0611d3f 100644 --- a/camel/camel-store-summary.c +++ b/camel/camel-store-summary.c @@ -371,9 +371,9 @@ camel_store_summary_load(CamelStoreSummary *s) error: i = ferror (in); - g_warning("Cannot load summary file: %s", strerror(ferror(in))); + g_warning ("Cannot load summary file: %s", strerror (ferror (in))); CAMEL_STORE_SUMMARY_UNLOCK(s, io_lock); - fclose(in); + fclose (in); s->flags |= ~CAMEL_STORE_SUMMARY_DIRTY; errno = i; @@ -409,13 +409,13 @@ camel_store_summary_save(CamelStoreSummary *s) fd = open(s->summary_path, O_RDWR|O_CREAT|O_TRUNC, 0600); if (fd == -1) { - io(printf("** open error: %s\n", strerror(errno))); + io(printf("** open error: %s\n", strerror (errno))); return -1; } out = fdopen(fd, "w"); if ( out == NULL ) { i = errno; - printf("** fdopen error: %s\n", strerror(errno)); + printf("** fdopen error: %s\n", strerror (errno)); close(fd); errno = i; return -1; diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c index 707fcfec94..04dcb0d3cb 100644 --- a/camel/camel-tcp-stream-raw.c +++ b/camel/camel-tcp-stream-raw.c @@ -149,7 +149,7 @@ flaky_tcp_write (int fd, const char *buffer, size_t buflen) printf ("flaky_tcp_write (%d, ..., %d): (%d) '%.*s'", fd, buflen, len, (int) len, buffer); nwritten = write (fd, buffer, len); if (nwritten < 0) - printf (" errno => %s\n", g_strerror (errno)); + printf (" errno => %s\n", strerror (errno)); else if (nwritten < len) printf (" only wrote %d bytes\n", nwritten); else @@ -200,7 +200,7 @@ flaky_tcp_read (int fd, char *buffer, size_t buflen) printf ("flaky_tcp_read (%d, ..., %d): (%d)", fd, buflen, len); nread = read (fd, buffer, len); if (nread < 0) - printf (" errno => %s\n", g_strerror (errno)); + printf (" errno => %s\n", strerror (errno)); else if (nread < len) printf (" only read %d bytes\n", nread); else diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c index e2604adbc0..3aa841d9df 100644 --- a/camel/camel-tcp-stream-ssl.c +++ b/camel/camel-tcp-stream-ssl.c @@ -503,34 +503,34 @@ camel_certdb_nss_cert_get(CamelCertDB *certdb, CERTCertificate *cert) int fd; ssize_t len; struct stat st; - - fingerprint = cert_fingerprint(cert); - ccert = camel_certdb_get_cert(certdb, fingerprint); + + fingerprint = cert_fingerprint (cert); + ccert = camel_certdb_get_cert (certdb, fingerprint); if (ccert == NULL) { - g_free(fingerprint); + g_free (fingerprint); return ccert; } - + if (ccert->rawcert == NULL) { - path = g_strdup_printf("%s/.camel_certs/%s", getenv("HOME"), fingerprint); - if (stat(path, &st) == -1 - || (fd = open(path, O_RDONLY)) == -1) { - g_warning("could not load cert %s: %s", path, strerror(errno)); - g_free(fingerprint); - g_free(path); - camel_cert_set_trust(certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN); - camel_certdb_touch(certdb); - + path = g_strdup_printf ("%s/.camel_certs/%s", getenv ("HOME"), fingerprint); + if (stat (path, &st) == -1 + || (fd = open (path, O_RDONLY)) == -1) { + g_warning ("could not load cert %s: %s", path, strerror (errno)); + g_free (fingerprint); + g_free (path); + camel_cert_set_trust (certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN); + camel_certdb_touch (certdb); + return ccert; } g_free(path); - ccert->rawcert = g_byte_array_new(); + ccert->rawcert = g_byte_array_new (); g_byte_array_set_size(ccert->rawcert, st.st_size); len = read(fd, ccert->rawcert->data, st.st_size); close(fd); if (len != st.st_size) { - g_warning("cert size read truncated %s: %d != %ld", path, len, st.st_size); + g_warning ("cert size read truncated %s: %d != %ld", path, len, st.st_size); g_byte_array_free(ccert->rawcert, TRUE); ccert->rawcert = NULL; g_free(fingerprint); @@ -586,11 +586,12 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate struct stat st; fingerprint = ccert->fingerprint; - + if (ccert->rawcert == NULL) - ccert->rawcert = g_byte_array_new(); - g_byte_array_set_size(ccert->rawcert, cert->derCert.len); - memcpy(ccert->rawcert->data, cert->derCert.data, cert->derCert.len); + ccert->rawcert = g_byte_array_new (); + + g_byte_array_set_size (ccert->rawcert, cert->derCert.len); + memcpy (ccert->rawcert->data, cert->derCert.data, cert->derCert.len); dir = g_strdup_printf ("%s/.camel_certs", getenv ("HOME")); if (stat (dir, &st) == -1 && mkdir (dir, 0700) == -1) { @@ -602,19 +603,19 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate path = g_strdup_printf ("%s/%s", dir, fingerprint); g_free (dir); - stream = camel_stream_fs_new_with_name(path, O_WRONLY|O_CREAT|O_TRUNC, 0600); + stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (stream != NULL) { - if (camel_stream_write(stream, ccert->rawcert->data, ccert->rawcert->len) != ccert->rawcert->len) { - g_warning("Could not save cert: %s: %s", path, strerror(errno)); - unlink(path); + if (camel_stream_write (stream, ccert->rawcert->data, ccert->rawcert->len) == -1) { + g_warning ("Could not save cert: %s: %s", path, strerror (errno)); + unlink (path); } - camel_stream_close(stream); - camel_object_unref(stream); + camel_stream_close (stream); + camel_object_unref (stream); } else { - g_warning("Could not save cert: %s: %s", path, strerror(errno)); + g_warning ("Could not save cert: %s: %s", path, strerror (errno)); } - g_free(path); + g_free (path); } diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c index 3d0e71a265..60dc5b7402 100644 --- a/camel/camel-text-index.c +++ b/camel/camel-text-index.c @@ -190,11 +190,13 @@ text_index_add_name_to_word(CamelIndex *idx, const char *word, camel_key_t namei data = 0; wordid = camel_key_table_add(p->word_index, word, 0, 0); if (wordid == 0){ - g_warning("Could not create key entry for word '%s': %s\n", word, strerror(errno)); + g_warning ("Could not create key entry for word '%s': %s\n", + word, strerror (errno)); return; } if (camel_partition_table_add(p->word_hash, word, wordid) == -1) { - g_warning("Could not create hash entry for word '%s': %s\n", word, strerror(errno)); + g_warning ("Could not create hash entry for word '%s': %s\n", + word, strerror (errno)); return; } rb->words++; @@ -202,7 +204,8 @@ text_index_add_name_to_word(CamelIndex *idx, const char *word, camel_key_t namei } else { data = camel_key_table_lookup(p->word_index, wordid, NULL, 0); if (data == 0) { - g_warning("Could not find key entry for word '%s': %s\n", word, strerror(errno)); + g_warning ("Could not find key entry for word '%s': %s\n", + word, strerror (errno)); return; } } @@ -902,14 +905,14 @@ camel_text_index_check(const char *path) sprintf(block, "%s.index", path); blocks = camel_block_file_new(block, O_RDONLY, CAMEL_TEXT_INDEX_VERSION, CAMEL_BLOCK_SIZE); if (blocks == NULL) { - io(printf("Check failed: No block file: %s\n", strerror(errno))); + io(printf("Check failed: No block file: %s\n", strerror (errno))); return -1; } key = alloca(strlen(path)+12); sprintf(key, "%s.index.data", path); keys = camel_key_file_new(key, O_RDONLY, CAMEL_TEXT_INDEX_KEY_VERSION); if (keys == NULL) { - io(printf("Check failed: No key file: %s\n", strerror(errno))); + io(printf("Check failed: No key file: %s\n", strerror (errno))); camel_object_unref((CamelObject *)blocks); return -1; } diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index 3271288389..8fd0a23e2f 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -253,7 +253,7 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con lf->index = (CamelIndex *)camel_text_index_new(lf->index_path, flag); if (lf->index == NULL) { /* yes, this isn't fatal at all */ - g_warning("Could not open/create index file: %s: indexing not performed", strerror(errno)); + g_warning("Could not open/create index file: %s: indexing not performed", strerror (errno)); forceindex = FALSE; /* record that we dont have an index afterall */ flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX; diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index 7a9cd86de1..b325df769a 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -151,8 +151,9 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce if (errno != ENOENT || (flags & CAMEL_STORE_FOLDER_CREATE) == 0) { - camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - _("Cannot get folder: %s: %s"), path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Cannot get folder: %s: %s"), + path, g_strerror (errno)); return NULL; } @@ -164,11 +165,11 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce slash = strchr(slash+1, '/'); if (slash) *slash = 0; - if (stat(sub, &st) == -1) { - if (errno != ENOENT - || mkdir(sub, 0700) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - _("Cannot get folder: %s: %s"), path, strerror(errno)); + if (stat (sub, &st) == -1) { + if (errno != ENOENT || mkdir (sub, 0700) == -1) { + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Cannot get folder: %s: %s"), + path, g_strerror (errno)); return NULL; } } @@ -234,8 +235,9 @@ create_folder(CamelStore *store, const char *parent_name, const char *folder_nam name = g_strdup_printf("%s/%s", path, folder_name); if (stat(name, &st) == 0 || errno != ENOENT) { - camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - _("Cannot get folder: %s: %s"), name, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Cannot get folder: %s: %s"), + name, g_strerror (errno)); g_free(name); return NULL; } @@ -302,9 +304,9 @@ static int xrename(const char *oldp, const char *newp, const char *prefix, const } if (ret == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not rename folder %s to %s: %s"), - old, new, strerror(err)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not rename folder %s to %s: %s"), + old, new, g_strerror (err)); } g_free(old); @@ -359,9 +361,9 @@ summary_failed: } else camel_text_index_rename(newibex, oldibex); ibex_failed: - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not rename '%s': %s"), - old, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not rename '%s': %s"), + old, g_strerror (errno)); CAMEL_STORE_UNLOCK(store, cache_lock); g_free(newibex); @@ -380,9 +382,9 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name); str = g_strdup_printf("%s.ev-summary", name); if (unlink(str) == -1 && errno != ENOENT) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not delete folder summary file `%s': %s"), - str, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not delete folder summary file `%s': %s"), + str, g_strerror (errno)); g_free(str); g_free (name); return; @@ -390,9 +392,9 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) g_free(str); str = g_strdup_printf("%s.ibex", name); if (camel_text_index_remove(str) == -1 && errno != ENOENT) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not delete folder index file `%s': %s"), - str, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not delete folder index file `%s': %s"), + str, g_strerror (errno)); g_free(str); g_free (name); return; diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c index 18c0b80ce5..4e83224cfe 100644 --- a/camel/providers/local/camel-local-summary.c +++ b/camel/providers/local/camel-local-summary.c @@ -394,13 +394,15 @@ local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeIn ret = camel_folder_summary_save((CamelFolderSummary *)cls); if (ret == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not save summary: %s: %s"), cls->folder_path, strerror(errno)); - g_warning("Could not save summary for %s: %s", cls->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not save summary: %s: %s"), + cls->folder_path, g_strerror (errno)); + + g_warning ("Could not save summary for %s: %s", cls->folder_path, strerror (errno)); } if (cls->index && camel_index_sync(cls->index) == -1) - g_warning("Could not sync index for %s: %s", cls->folder_path, strerror(errno)); + g_warning ("Could not sync index for %s: %s", cls->folder_path, strerror (errno)); return ret; } diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c index 05fdd70e10..d3cbc490b5 100644 --- a/camel/providers/local/camel-maildir-folder.c +++ b/camel/providers/local/camel-maildir-folder.c @@ -221,8 +221,9 @@ static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * camel_folder_summary_info_free(folder->summary, info); if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) { - camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"), - name, g_strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, + _("Cannot get message: %s\n %s"), + name, g_strerror (errno)); g_free(name); return NULL; } diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c index 53d554d16a..8e6cc1ee9d 100644 --- a/camel/providers/local/camel-maildir-store.c +++ b/camel/providers/local/camel-maildir-store.c @@ -102,20 +102,20 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce if (stat(name, &st) == -1) { if (errno != ENOENT) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not open folder `%s':\n%s"), - folder_name, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not open folder `%s':\n%s"), + folder_name, g_strerror (errno)); } else if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) { - camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - _("Folder `%s' does not exist."), folder_name); + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Folder `%s' does not exist."), folder_name); } else { if (mkdir(name, 0700) != 0 || mkdir(tmp, 0700) != 0 || mkdir(cur, 0700) != 0 || mkdir(new, 0700) != 0) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create folder `%s':\n%s"), - folder_name, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not create folder `%s':\n%s"), + folder_name, g_strerror (errno)); rmdir(tmp); rmdir(cur); rmdir(new); @@ -163,9 +163,10 @@ static void delete_folder(CamelStore * store, const char *folder_name, CamelExce || stat(tmp, &st) == -1 || !S_ISDIR(st.st_mode) || stat(cur, &st) == -1 || !S_ISDIR(st.st_mode) || stat(new, &st) == -1 || !S_ISDIR(st.st_mode)) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not delete folder `%s': %s"), - folder_name, errno?strerror(errno):_("not a maildir directory")); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not delete folder `%s': %s"), + folder_name, errno ? g_strerror (errno) : + _("not a maildir directory")); } else { int err = 0; @@ -200,9 +201,9 @@ static void delete_folder(CamelStore * store, const char *folder_name, CamelExce mkdir(cur, 0700); mkdir(new, 0700); mkdir(tmp, 0700); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not delete folder `%s': %s"), - folder_name, strerror(err)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not delete folder `%s': %s"), + folder_name, g_strerror (err)); } else { /* and remove metadata */ ((CamelStoreClass *)parent_class)->delete_folder(store, folder_name, ex); @@ -331,9 +332,9 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch if (((flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) || parent == NULL)) { dir = opendir(name); if (dir == NULL) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not scan folder `%s': %s"), - root, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not scan folder `%s': %s"), + root, g_strerror (errno)); g_free(name); return -1; } diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c index ae3b81438b..ea3c1b8dbf 100644 --- a/camel/providers/local/camel-maildir-summary.c +++ b/camel/providers/local/camel-maildir-summary.c @@ -413,7 +413,9 @@ static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelExc dir = opendir(cur); if (dir == NULL) { - camel_exception_setv(ex, 1, _("Cannot open maildir directory path: %s: %s"), cls->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot open maildir directory path: %s: %s"), + cls->folder_path, g_strerror (errno)); g_free(cur); return -1; } @@ -461,7 +463,7 @@ static int camel_maildir_summary_add(CamelLocalSummary *cls, const char *name, i fd = open(filename, O_RDONLY); if (fd == -1) { - g_warning("Cannot summarise/index: %s: %s", filename, strerror(errno)); + g_warning ("Cannot summarise/index: %s: %s", filename, strerror (errno)); g_free(filename); return -1; } @@ -542,7 +544,9 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca no longer exist */ dir = opendir(cur); if (dir == NULL) { - camel_exception_setv(ex, 1, _("Cannot open maildir directory path: %s: %s"), cls->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot open maildir directory path: %s: %s"), + cls->folder_path, g_strerror (errno)); g_free(cur); g_free(new); camel_operation_end(NULL); diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c index 8d1fdfd543..e06a63fe47 100644 --- a/camel/providers/local/camel-mbox-folder.c +++ b/camel/providers/local/camel-mbox-folder.c @@ -155,7 +155,9 @@ static int mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *e mf->lockfd = open(lf->folder_path, O_RDWR, 0); if (mf->lockfd == -1) { - camel_exception_setv(ex, 1, _("Cannot create folder lock on %s: %s"), lf->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot create folder lock on %s: %s"), + lf->folder_path, g_strerror (errno)); return -1; } @@ -212,7 +214,9 @@ mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const Camel output_stream = camel_stream_fs_new_with_name(lf->folder_path, O_WRONLY|O_APPEND, 0600); if (output_stream == NULL) { - camel_exception_setv(ex, 1, _("Cannot open mailbox: %s: %s\n"), lf->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot open mailbox: %s: %s\n"), + lf->folder_path, g_strerror (errno)); goto fail; } @@ -361,9 +365,9 @@ retry: fd = open(lf->folder_path, O_RDONLY); if (fd == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, - _("Cannot get message: %s from folder %s\n %s"), uid, lf->folder_path, - strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, + _("Cannot get message: %s from folder %s\n %s"), + uid, lf->folder_path, g_strerror (errno)); goto fail; } diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c index cfe3429713..9bf6737372 100644 --- a/camel/providers/local/camel-mbox-store.c +++ b/camel/providers/local/camel-mbox-store.c @@ -90,25 +90,25 @@ get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelExcep int fd; if (errno != ENOENT) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not open file `%s':\n%s"), - name, g_strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not open file `%s':\n%s"), + name, g_strerror (errno)); g_free(name); return NULL; } if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) { - camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - _("Folder `%s' does not exist."), - folder_name); + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Folder `%s' does not exist."), + folder_name); g_free(name); return NULL; } fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0600); if (fd == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create file `%s':\n%s"), - name, g_strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not create file `%s':\n%s"), + name, g_strerror (errno)); g_free(name); return NULL; } diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c index 564914aa59..5b001c0977 100644 --- a/camel/providers/local/camel-mbox-summary.c +++ b/camel/providers/local/camel-mbox-summary.c @@ -346,9 +346,10 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan fd = open(cls->folder_path, O_RDONLY); if (fd == -1) { - d(printf("%s failed to open: %s\n", cls->folder_path, strerror(errno))); - camel_exception_setv(ex, 1, _("Could not open folder: %s: %s"), - cls->folder_path, strerror(errno)); + d(printf("%s failed to open: %s\n", cls->folder_path, strerror (errno))); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not open folder: %s: %s"), + cls->folder_path, g_strerror (errno)); camel_operation_end(NULL); return -1; } @@ -450,7 +451,9 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel /* check if the summary is up-to-date */ if (stat(cls->folder_path, &st) == -1) { camel_folder_summary_clear(s); - camel_exception_setv(ex, 1, _("Cannot check folder: %s: %s"), cls->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot check folder: %s: %s"), + cls->folder_path, g_strerror (errno)); return -1; } @@ -584,9 +587,9 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang fd = open(cls->folder_path, O_RDONLY); if (fd == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not open file: %s: %s"), - cls->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not open file: %s: %s"), + cls->folder_path, g_strerror (errno)); camel_operation_end(NULL); return -1; } @@ -596,8 +599,9 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang d(printf("Writing tmp file to %s\n", tmpname)); fdout = open(tmpname, O_WRONLY|O_CREAT|O_TRUNC, 0600); if (fdout == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot open temporary mailbox: %s"), strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot open temporary mailbox: %s"), + g_strerror (errno)); goto error; } @@ -607,19 +611,19 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang d(printf("Closing folders\n")); if (close(fd) == -1) { - g_warning("Cannot close source folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not close source folder %s: %s"), - cls->folder_path, strerror(errno)); + g_warning("Cannot close source folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not close source folder %s: %s"), + cls->folder_path, g_strerror (errno)); fd = -1; goto error; } if (close(fdout) == -1) { - g_warning("Cannot close tmp folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not close temp folder: %s"), - strerror(errno)); + g_warning("Cannot close tmp folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not close temp folder: %s"), + g_strerror (errno)); fdout = -1; goto error; } @@ -627,10 +631,10 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang /* this should probably either use unlink/link/unlink, or recopy over the original mailbox, for various locking reasons/etc */ if (rename(tmpname, cls->folder_path) == -1) { - g_warning("Cannot rename folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not rename folder: %s"), - strerror(errno)); + g_warning("Cannot rename folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not rename folder: %s"), + g_strerror (errno)); goto error; } tmpname = NULL; @@ -674,9 +678,9 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan fd = open(cls->folder_path, O_RDWR); if (fd == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not open file: %s: %s"), - cls->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not open file: %s: %s"), + cls->folder_path, g_strerror (errno)); camel_operation_end(NULL); return -1; @@ -769,10 +773,10 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan d(printf("Closing folders\n")); if (close(fd) == -1) { - g_warning("Cannot close source folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not close source folder %s: %s"), - cls->folder_path, strerror(errno)); + g_warning ("Cannot close source folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not close source folder %s: %s"), + cls->folder_path, g_strerror (errno)); fd = -1; goto error; } @@ -845,7 +849,8 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf return -1; if (stat(cls->folder_path, &st) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Unknown error: %s"), strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Unknown error: %s"), g_strerror (errno)); return -1; } @@ -879,8 +884,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh /* need to dup this because the mime-parser owns the fd after we give it to it */ fd = dup(fd); if (fd == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not store folder: %s"), strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not store folder: %s"), + g_strerror (errno)); return -1; } @@ -972,9 +978,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh #endif if (len == -1) { d(printf("Error writing to tmp mailbox\n")); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Error writing to temp mailbox: %s"), - strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Error writing to temp mailbox: %s"), + g_strerror (errno)); goto error; } info->info.flags &= 0xffff; @@ -989,17 +995,18 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_PRE_FROM) { /*d(printf("copying mbox contents to tmp: '%.*s'\n", len, buffer));*/ if (write(fdout, buffer, len) != len) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Writing to tmp mailbox failed: %s: %s"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Writing to tmp mailbox failed: %s: %s"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno)); goto error; } } if (write(fdout, "\n", 1) != 1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Error writing to temp mailbox: %s"), - strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Error writing to temp mailbox: %s"), + g_strerror (errno)); goto error; } diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c index 396435da0e..02d3370428 100644 --- a/camel/providers/local/camel-mh-folder.c +++ b/camel/providers/local/camel-mh-folder.c @@ -207,16 +207,18 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, name = g_strdup_printf("%s/%s", lf->folder_path, uid); if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) { - camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"), - name, g_strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, + _("Cannot get message: %s\n %s"), + name, g_strerror (errno)); g_free(name); return NULL; } message = camel_mime_message_new(); if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("Cannot get message: %s\n %s"), - name, _("Invalid message contents")); + camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, + _("Cannot get message: %s\n %s"), + name, _("Invalid message contents")); g_free(name); camel_object_unref((CamelObject *)message_stream); camel_object_unref((CamelObject *)message); diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c index a92db83797..6c442d335b 100644 --- a/camel/providers/local/camel-mh-store.c +++ b/camel/providers/local/camel-mh-store.c @@ -200,7 +200,7 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce if (errno != ENOENT) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not open folder `%s':\n%s"), - folder_name, g_strerror(errno)); + folder_name, g_strerror (errno)); g_free (name); return NULL; } @@ -214,7 +214,7 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce if (mkdir(name, 0700) != 0) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create folder `%s':\n%s"), - folder_name, g_strerror(errno)); + folder_name, g_strerror (errno)); g_free (name); return NULL; } @@ -248,9 +248,9 @@ static void delete_folder(CamelStore * store, const char *folder_name, CamelExce /* remove folder directory - will fail if not empty */ name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name); if (rmdir(name) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not delete folder `%s': %s"), - folder_name, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not delete folder `%s': %s"), + folder_name, g_strerror (errno)); g_free(name); return; } diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c index f809fa2601..25794fa258 100644 --- a/camel/providers/local/camel-mh-summary.c +++ b/camel/providers/local/camel-mh-summary.c @@ -174,7 +174,7 @@ static int camel_mh_summary_add(CamelLocalSummary *cls, const char *name, int fo fd = open(filename, O_RDONLY); if (fd == -1) { - g_warning("Cannot summarise/index: %s: %s", filename, strerror(errno)); + g_warning ("Cannot summarise/index: %s: %s", filename, strerror (errno)); g_free(filename); return -1; } @@ -240,7 +240,9 @@ mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, Came no longer exist */ dir = opendir(cls->folder_path); if (dir == NULL) { - camel_exception_setv(ex, 1, _("Cannot open MH directory path: %s: %s"), cls->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot open MH directory path: %s: %s"), + cls->folder_path, g_strerror (errno)); return -1; } @@ -348,7 +350,7 @@ mh_summary_sync_message(CamelLocalSummary *cls, CamelMessageInfo *info, CamelExc ret = -1; } } else { - g_warning("sync can't create tmp file: %s", strerror(errno)); + g_warning("sync can't create tmp file: %s", strerror (errno)); } g_free(tmpname); } else { diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c index 8118468a60..d667310090 100644 --- a/camel/providers/local/camel-spool-folder.c +++ b/camel/providers/local/camel-spool-folder.c @@ -145,7 +145,9 @@ spool_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex) mf->lockfd = open(lf->folder_path, O_RDWR, 0); if (mf->lockfd == -1) { - camel_exception_setv(ex, 1, _("Cannot create folder lock on %s: %s"), lf->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot create folder lock on %s: %s"), + lf->folder_path, g_strerror (errno)); return -1; } diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c index dc35f75a2a..f2cbdd1e55 100644 --- a/camel/providers/local/camel-spool-store.c +++ b/camel/providers/local/camel-spool-store.c @@ -114,9 +114,9 @@ construct (CamelService *service, CamelSession *session, CamelProvider *provider } if (stat(service->url->path, &st) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - _("Spool `%s' cannot be opened: %s"), - service->url->path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Spool `%s' cannot be opened: %s"), + service->url->path, g_strerror (errno)); return; } @@ -156,17 +156,18 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name); if (stat(name, &st) == -1) { if (errno != ENOENT) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not open folder `%s':\n%s"), - folder_name, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not open folder `%s':\n%s"), + folder_name, g_strerror (errno)); } else if ((flags & CAMEL_STORE_FOLDER_CREATE) == 0) { - camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, - _("Folder `%s' does not exist."), folder_name); + camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Folder `%s' does not exist."), + folder_name); } else { - if (creat(name, 0600) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not create folder `%s':\n%s"), - folder_name, strerror(errno)); + if (creat (name, 0600) == -1) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not create folder `%s':\n%s"), + folder_name, g_strerror (errno)); } else { folder = camel_spool_folder_new(store, folder_name, flags, ex); } @@ -278,9 +279,9 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch name = root; if (stat(name, &st) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not scan folder `%s': %s"), - name, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not scan folder `%s': %s"), + name, g_strerror (errno)); } else if (S_ISREG(st.st_mode)) { /* incase we start scanning from a file. messy duplication :-/ */ if (path) { @@ -308,9 +309,9 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch dir = opendir(name); if (dir == NULL) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not scan folder `%s': %s"), - name, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not scan folder `%s': %s"), + name, g_strerror (errno)); return -1; } diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c index 3a1a15cbc8..d71c75eaf8 100644 --- a/camel/providers/local/camel-spool-summary.c +++ b/camel/providers/local/camel-spool-summary.c @@ -146,9 +146,10 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan fd = open(((CamelLocalSummary *)cls)->folder_path, O_RDWR); if (fd == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not open file: %s: %s"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not open file: %s: %s"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno)); camel_operation_end(NULL); return -1; } @@ -165,8 +166,9 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan #endif d(printf("Writing tmp file to %s\n", tmpname)); if (fdout == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot open temporary mailbox: %s"), strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot open temporary mailbox: %s"), + g_strerror (errno)); goto error; } @@ -176,28 +178,31 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan /* sync out content */ if (fsync(fdout) == -1) { - g_warning("Cannot sync temporary folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not sync temporary folder %s: %s"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno)); + g_warning("Cannot sync temporary folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not sync temporary folder %s: %s"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno)); goto error; } /* see if we can write this much to the spool file */ if (fstat(fd, &st) == -1) { - g_warning("Cannot sync temporary folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not sync temporary folder %s: %s"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno)); + g_warning("Cannot sync temporary folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not sync temporary folder %s: %s"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno)); goto error; } spoollen = st.st_size; if (fstat(fdout, &st) == -1) { - g_warning("Cannot sync temporary folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not sync temporary folder %s: %s"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno)); + g_warning("Cannot sync temporary folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not sync temporary folder %s: %s"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno)); goto error; } outlen = st.st_size; @@ -209,10 +214,11 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan || fsync(fd) == -1 || lseek(fd, 0, SEEK_SET) == -1 || lseek(fdout, 0, SEEK_SET) == -1)) { - g_warning("Cannot sync spool folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not sync spool folder %s: %s"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno)); + g_warning("Cannot sync spool folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not sync spool folder %s: %s"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno)); /* incase we ran out of room, remove any trailing space first */ ftruncate(fd, spoollen); goto error; @@ -240,10 +246,11 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan } if (size == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not sync spool folder %s: %s\n" - "Folder may be corrupt, copy saved in `%s'"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno), tmpnam); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not sync spool folder %s: %s\n" + "Folder may be corrupt, copy saved in `%s'"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno), tmpnam); /* so we dont delete it */ close(fdout); tmpname = NULL; @@ -258,10 +265,11 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan d(printf("Closing folders\n")); if (ftruncate(fd, outlen) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not sync spool folder %s: %s\n" - "Folder may be corrupt, copy saved in `%s'"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno), tmpnam); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not sync spool folder %s: %s\n" + "Folder may be corrupt, copy saved in `%s'"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno), tmpnam); close(fdout); tmpname = NULL; fdout = -1; @@ -269,11 +277,12 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan } if (close(fd) == -1) { - g_warning("Cannot close source folder: %s", strerror(errno)); - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Could not sync spool folder %s: %s\n" - "Folder may be corrupt, copy saved in `%s'"), - ((CamelLocalSummary *)cls)->folder_path, strerror(errno), tmpnam); + g_warning("Cannot close source folder: %s", strerror (errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not sync spool folder %s: %s\n" + "Folder may be corrupt, copy saved in `%s'"), + ((CamelLocalSummary *)cls)->folder_path, + g_strerror (errno), tmpnam); close(fdout); tmpname = NULL; fdout = -1; @@ -329,7 +338,9 @@ spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, C return -1; if (stat(cls->folder_path, &st) == -1) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Unknown error: %s"), strerror(errno)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Unknown error: %s"), + g_strerror (errno)); return -1; } |