Date: Fri, 8 Jul 2011 15:48:55 +0200 From: Robert Millan <rmh@debian.org> To: Ed Schouten <ed@80386.nl> Cc: freebsd-hackers@freebsd.org, Ed Maste <emaste@freebsd.org>, debian-hurd@lists.debian.org Subject: Re: [PATCH] avoid assuming MAXPATHLEN in config(8) Message-ID: <CAOfDtXNK5Sn2jVzc0GREs=-fv6Y_gx7Tg7jfrqjPd8KgTQ9ozA@mail.gmail.com> In-Reply-To: <20110707111751.GI71453@hoeg.nl> References: <CAOfDtXNreaFYKvyR_C15dk9mOqU30_Z4gHxQPkPH5ntY7rRtzA@mail.gmail.com> <20110707100123.GF71453@hoeg.nl> <CAOfDtXN0RkYaWKidXjwJd3UP9LNmW0BdFqH5boMUA_W19%2BsUiQ@mail.gmail.com> <20110707111751.GI71453@hoeg.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--bcaec544eb763f1c1804a78f1802 Content-Type: text/plain; charset=UTF-8 2011/7/7 Ed Schouten <ed@80386.nl>: > Considering that the function is rather small anyway, why not compile it > in unconditionally (though having a different name). Hi Ed, I made the adjustment you requested, plus a bit more polishing (plugged a memleak, etc), and then I hit what seems like a memory corruption heisenbug. I haven't been able to determine whether my patch introduces this bug or it just uncovers it. As for now please disregard my request untill I have time to debug this properly. Thanks -- Robert Millan --bcaec544eb763f1c1804a78f1802 Content-Type: text/plain; charset=US-ASCII; name="maxpathlen.diff" Content-Disposition: attachment; filename="maxpathlen.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gpv7b3xu1 PT09IG1vZGlmaWVkIGZpbGUgJ2NvbmZpZy5oJwotLS0gY29uZmlnLmgJMjAxMS0wNy0wNyAxMzo1 OTowNSArMDAwMAorKysgY29uZmlnLmgJMjAxMS0wNy0wNyAxNDowNjoyOCArMDAwMApAQCAtMTk5 LDcgKzE5OSw3IEBACiBleHRlcm4gaW50CW1heHVzZXJzOwogCiBleHRlcm4gY2hhciAqUFJFRklY OwkJLyogQ29uZmlnIGZpbGUgbmFtZSAtIGZvci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VuYW1lKTsKIAkJcmVhZF9vcHRpb25fZmlsZShmbmFtZSwgMCk7CiAJfQorCWZy ZWUoZm5hbWUpOwogCXJlYWRfb3B0aW9uX2ZpbGUoIi4uLy4uL2NvbmYvb3B0aW9ucy1jb21wYXQi LCBPTF9BTElBUyk7CiB9CiAKCg== --bcaec544eb763f1c1804a78f1802--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXNK5Sn2jVzc0GREs=-fv6Y_gx7Tg7jfrqjPd8KgTQ9ozA>