[PATCH] msmtp-home_etc.patch
Jan Palus
Jan.Palus w unixlab.cs.put.poznan.pl
Sob, 17 Wrz 2005, 15:02:55 CEST
Po aktualizacji msmtp do v1.4.4 zaczal segfaultowac przy prawie kazdej
okazji (msmtp --version rowniez). Okazalo sie ze winnym jest patch
msmtp-home_etc.patch:
>On Thu, 15. Sep 2005, 16:23:35 +0200, Jan Palus wrote:
>> I recently upgraded msmtp to version 1.4.4 and it keeps segfaulting
>> in most cases:
>
>You're from PLD Linux, right? I suspect your home_etc patch is wrong.
>In os_env.c, get_homedir() is required to return a pointer to an
>allocated string, but in your patched version it returns
>the same as getenv("HOME_ETC"), which is a pointer to a *static*
>string.
>That's why "free(homedir)" segfaults at msmtp.c:2784 and msmtp.c:2032.
>
>I suggest the following patch instead:
>
>--- msmtp-1.4.4/src/os_env.c.orig 2005-09-15 16:46:21.228902176 +0200
>+++ msmtp-1.4.4/src/os_env.c 2005-09-15 16:47:10.085474848 +0200
>@@ -266,7 +266,11 @@
> char *home;
> struct passwd *pw;
>
>- if ((home = getenv("HOME")))
>+ if ((home = getenv("HOME_ETC")))
>+ {
>+ home = xstrdup("home");
>+ }
>+ else if ((home = getenv("HOME")))
> {
> home = xstrdup(home);
> }
>
>
>Another possibility is to leave get_homedir() alone and use the
>following patch:
>
>--- msmtp-1.4.4/src/msmtp.c.orig 2005-09-15 16:48:13.445842608
>+0200
>+++ msmtp-1.4.4/src/msmtp.c 2005-09-15 16:48:43.468278504 +0200
>@@ -84,8 +84,8 @@
> #define NETRCFILE "_netrc"
> #else /* UNIX */
> #define SYSCONFFILE "msmtprc"
>-#define USERCONFFILE ".msmtprc"
>-#define NETRCFILE ".netrc"
>+#define USERCONFFILE ".etc/.msmtprc"
>+#define NETRCFILE ".etc/.netrc"
> #endif
>
> /* The name of this program */
>
>
>Best regards,
>Martin
druga propozycja mija sie troche z oczekiwanym rozwiazaniem, ale
pierwsza po malej modyfikacji jest juz calkiem sensowna. Poprawny
patch w zalaczniku.
-------------- następna część ---------
--- msmtp-1.4.4/src/os_env.c 2005-08-14 22:13:26.000000000 +0200
+++ msmtp-1.4.4/src/os_env.c.orig 2005-09-17 14:57:19.000000000 +0200
@@ -257,7 +257,11 @@
char *home;
- if ((home = getenv("HOME")))
+ if ((home = getenv("HOME_ETC")))
+ {
+ home = xstrdup(home);
+ }
+ else if ((home = getenv("HOME")))
{
home = xstrdup(home);
}
@@ -273,7 +277,11 @@
char *home;
struct passwd *pw;
- if ((home = getenv("HOME")))
+ if ((home = getenv("HOME_ETC")))
+ {
+ home = xstrdup(home);
+ }
+ else if ((home = getenv("HOME")))
{
home = xstrdup(home);
}
Więcej informacji o liście dyskusyjnej pld-devel-pl