Re: Signed usage of time_t
Juliusz Chroboczek <[email protected]>
| Newsgroups | gmane.comp.web.polipo.user |
|---|---|
| Message-ID | <[email protected]> |
> After some investigation I realized what the problem was: in some > cases the code uses negative values of time_t to (I assume) mean > "everything's OK". No, it uses negative time_t to mark unknown data. > QNX uses uint32_t to represent time_t, Yeah, I've heard -- and I think that's really stupid. Actually, they've changed to an unsigned time_t in version 6 -- previous versions had the reasonable definition. > POSIX doesn't specify exactly how time_t should be implemented, While that's correct, all systems known to man have signed time_t, except for QNX 6. As a matter of fact, some Unix interfaces make little sense with unsigned time_t -- for example time(2), which is defined to return ((time_t)-1) in case of failure. > I'm curious, was there any success running Polipo on NetBSD? Yes, it works fine -- like all reasonable systems, BSD Unix uses signed time_t. I've personally tested Polipo on NetBSD 1.6. > Anyways, I thought I'd bring this to the attention of the Polipo > developers in case there's an interest in fixing it. I suggest either compiling with the QNX 5 SDK, or adding the following to polipo.h: typedef signed int polipo_time_t; #define time_t polipo_time_t The proper fix would consist in changing -1 to ((time_t)-1) in places where it matters, but I think that's overkill. I'll add a test for signed time_t to Polipo's build process. -- Juliusz ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev