Changes to gnats/gnats/misc.c
Yngve Svendsen <[email protected]> Mon, 14 Oct 2002 18:50:12 -0400
| Newsgroups | gmane.comp.bug-tracking.gnats.patches |
|---|---|
| Message-ID | <[email protected]> |
Index: gnats/gnats/misc.c
diff -c gnats/gnats/misc.c:1.36 gnats/gnats/misc.c:1.37
*** gnats/gnats/misc.c:1.36 Sun Jan 6 11:13:20 2002
--- gnats/gnats/misc.c Mon Oct 14 18:50:11 2002
***************
*** 568,573 ****
--- 568,578 ----
char *fixed_template = (char*)xmalloc (strlen(template)+FORMAT_PADDING);
const char *in = template;
char *out = fixed_template;
+ /* Because brokentime points to static data (allocated
+ * by localtime()), it cannot be passed to a subroutine
+ * and then later be relied on to point to the same data. */
+ struct tm btime = *brokentime;
+ int result;
while (*in != '\0')
{
***************
*** 603,613 ****
}
*out = '\0';
! {
! int result = strftime (s, size, fixed_template, brokentime);
! free (fixed_template);
! return result;
! }
}
}
--- 608,616 ----
}
*out = '\0';
! result = strftime (s, size, fixed_template, &btime);
! free (fixed_template);
! return result;
}
}