Bug 23351

Summary: telepathy-idle-0.1.4: strnlen not portable enough
Product: Telepathy Reporter: Thomas Klausner <tk>
Component: idleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: misc, rishi.is
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: NetBSD   
Whiteboard:
i915 platform: i915 features:
Attachments: Workaround

Description Thomas Klausner 2009-08-16 12:07:16 UTC
Created attachment 28673 [details] [review]
Workaround

While strnlen is now in POSIX 2008, it is not yet available on all systems.
NetBSD-current only recently added it in May, so the last release doesn't have it.

Since it is only used in one file, a possible workaround is attached.
Comment 1 Debarshi Ray 2011-03-27 13:56:31 UTC
This is 2011. Is the workaround needed anymore?
Comment 2 Thomas Klausner 2011-03-28 02:30:06 UTC
Yes. NetBSD-5.1, the latest release, doesn't have strnlen.

If you don't like applying the patch, just close the bug report and we'll keep the patch in pkgsrc; that fixes the issue for most NetBSD users.

There might be other operating systems that don't support it though (e.g. Solaris added it after Solaris 9, not sure if it's in 10).
Comment 3 Will Thompson 2011-03-28 03:29:19 UTC
#ifndef doesn't work on functions — you're actually redefining strnlen on all platforms. :)

I've committed a slightly modified version: <http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=dbc99e7>. It will be released in 0.1.9. Thanks for the report!
Comment 4 Will Thompson 2011-10-03 10:06:19 UTC
*** Bug 15027 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.