Wireshark-bugs: [Wireshark-bugs] [Bug 4302] New: ctime() is not thread safe and it's obsolete.

Date: Mon, 7 Dec 2009 09:17:43 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4302

           Summary: ctime() is not thread safe and it's obsolete.
           Product: Wireshark
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Trivial
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: darkjames@xxxxxxxxxxxxxxxx


Created an attachment (id=4036)
 --> (https://bugs.wireshark.org/bugzilla/attachment.cgi?id=4036)
Replace ctime() with abs_time_secs_to_str()

Build Information:

--
ctime() returns statically allocated string, ctime_r() is thread safe version.
According to man, ctime() & ctime_r() is obsolete, and strftime() is
recommended.

In wireshark ctime is used only 5 times in dissectors + 1 in capinfo.
abs_time_secs_to_str() is used more often.

This patch replace remaining ctime calls in dissectors with call to
abs_time_secs_to_str.


Btw. abs_time_secs_to_str doesn't include the week day (maybe it's good idea to
have it?)


Btw2: abs_time_secs_to_str is also not thread-safe :> 
localtime() should be replaced with localtime_r() [don't know what about
portability]

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.