aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-07-15 19:14:03 +0000
committerGuy Harris <guy@alum.mit.edu>2001-07-15 19:14:03 +0000
commitb7255e108a8e22f9fc458ad644e43e9475f51fd0 (patch)
tree868384d9df93246ae15a0650cf5fdcc47b65cb23 /epan/to_str.c
parente574c8de6d5cd2684265ce041539614c8872f781 (diff)
Fixes, from Scott Renfro, for some calls to "localtime()" that didn't
check whether the call succeeded (it doesn't always do so on Windows, for example). svn path=/trunk/; revision=3722
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/epan/to_str.c b/epan/to_str.c
index bbf8e97ed0..26229c2be3 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -1,7 +1,7 @@
/* to_str.h
* Routines for utilities to convert various other types to strings.
*
- * $Id: to_str.c,v 1.9 2001/07/13 00:27:51 guy Exp $
+ * $Id: to_str.c,v 1.10 2001/07/15 19:14:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -411,15 +411,18 @@ abs_time_to_str(struct timeval *abs_time)
}
tmp = localtime(&abs_time->tv_sec);
- sprintf(cur, "%s %2d, %d %02d:%02d:%02d.%06ld",
- mon_names[tmp->tm_mon],
- tmp->tm_mday,
- tmp->tm_year + 1900,
- tmp->tm_hour,
- tmp->tm_min,
- tmp->tm_sec,
- (long)abs_time->tv_usec);
-
+ if (tmp) {
+ sprintf(cur, "%s %2d, %d %02d:%02d:%02d.%06ld",
+ mon_names[tmp->tm_mon],
+ tmp->tm_mday,
+ tmp->tm_year + 1900,
+ tmp->tm_hour,
+ tmp->tm_min,
+ tmp->tm_sec,
+ (long)abs_time->tv_usec);
+ } else {
+ strncpy(cur, "Not representable", sizeof(str[0]));
+ }
return cur;
}