bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] imap[s] seg fault in mail[x]


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] imap[s] seg fault in mail[x]
Date: Sun, 15 Feb 2009 11:04:59 +0200

Paul Vojta <address@hidden> ha escrit:

> I am getting a seg fault when running mail to access an imap folder.

Yes, an alignment problem on Solaris has recently been reported. Please
apply the attached patch.

Regards,
Sergey

diff --git a/mailbox/assoc.c b/mailbox/assoc.c
index f9b9bf5..6b53e86 100644
--- a/mailbox/assoc.c
+++ b/mailbox/assoc.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -58,7 +58,19 @@ struct _mu_assoc
   mu_iterator_t itr;
 };
 
-#define ASSOC_ELEM_SIZE(a) ((a)->elsize + sizeof(struct _mu_assoc_elem) - 1)
+struct _mu_assoc_elem_align
+{
+  char c;
+  struct _mu_assoc_elem x;
+};
+
+#define __ASSOC_ELEM_ALIGNMENT (mu_offsetof(struct _mu_assoc_elem_align, x))
+
+#define __ASSOC_ELEM_SIZE(a) \
+   ((a)->elsize + mu_offsetof(struct _mu_assoc_elem, data))
+#define __ASSOC_ALIGN(a, b) (((a) + (b) - 1) & ~((b) - 1))
+#define ASSOC_ELEM_SIZE(a) \
+   __ASSOC_ALIGN(__ASSOC_ELEM_SIZE(a),__ASSOC_ELEM_ALIGNMENT)
 
 #define __ASSOC_ELEM(a,p,n) \
  ((struct _mu_assoc_elem*) ((char*) (p) + ASSOC_ELEM_SIZE (a) * n))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]