summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenys Vlasenko2010-01-09 19:10:49 +0100
committerDenys Vlasenko2010-01-09 19:10:49 +0100
commitdc698bb038756a926aaa529bda1b939eab2c1676 (patch)
tree4084a40897d9d81816228935a1398e80dd4b173b /archival
parent0681137972dc89b5003b0415e09184c0ecf1c875 (diff)
downloadbusybox-dc698bb038756a926aaa529bda1b939eab2c1676.zip
busybox-dc698bb038756a926aaa529bda1b939eab2c1676.tar.gz
*: make it easier to distinquish "struct tm", pointer to one, etc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/header_verbose_list.c34
-rw-r--r--archival/rpm.c6
2 files changed, 24 insertions, 16 deletions
diff --git a/archival/libunarchive/header_verbose_list.c b/archival/libunarchive/header_verbose_list.c
index da21a15..f6f04cf 100644
--- a/archival/libunarchive/header_verbose_list.c
+++ b/archival/libunarchive/header_verbose_list.c
@@ -8,7 +8,8 @@
void FAST_FUNC header_verbose_list(const file_header_t *file_header)
{
- struct tm *mtime = localtime(&(file_header->mtime));
+ struct tm tm_time;
+ struct tm *ptm = &tm_time; //localtime(&file_header->mtime);
#if ENABLE_FEATURE_TAR_UNAME_GNAME
char uid[sizeof(int)*3 + 2];
@@ -16,6 +17,8 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
char *user;
char *group;
+ localtime_r(&file_header->mtime, ptm);
+
user = file_header->tar__uname;
if (user == NULL) {
sprintf(uid, "%u", (unsigned)file_header->uid);
@@ -31,26 +34,31 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
user,
group,
file_header->size,
- 1900 + mtime->tm_year,
- 1 + mtime->tm_mon,
- mtime->tm_mday,
- mtime->tm_hour,
- mtime->tm_min,
- mtime->tm_sec,
+ 1900 + ptm->tm_year,
+ 1 + ptm->tm_mon,
+ ptm->tm_mday,
+ ptm->tm_hour,
+ ptm->tm_min,
+ ptm->tm_sec,
file_header->name);
+
#else /* !FEATURE_TAR_UNAME_GNAME */
+
+ localtime_r(&file_header->mtime, ptm);
+
printf("%s %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(file_header->mode),
(unsigned)file_header->uid,
(unsigned)file_header->gid,
file_header->size,
- 1900 + mtime->tm_year,
- 1 + mtime->tm_mon,
- mtime->tm_mday,
- mtime->tm_hour,
- mtime->tm_min,
- mtime->tm_sec,
+ 1900 + ptm->tm_year,
+ 1 + ptm->tm_mon,
+ ptm->tm_mday,
+ ptm->tm_hour,
+ ptm->tm_min,
+ ptm->tm_sec,
file_header->name);
+
#endif /* FEATURE_TAR_UNAME_GNAME */
if (file_header->link_target) {
diff --git a/archival/rpm.c b/archival/rpm.c
index cdaf50f..6c1e341 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -145,13 +145,13 @@ int rpm_main(int argc, char **argv)
if (func & rpm_query_info) {
/* Do the nice printout */
time_t bdate_time;
- struct tm *bdate;
+ struct tm *bdate_ptm;
char bdatestring[50];
printf("Name : %-29sRelocations: %s\n", rpm_getstr(TAG_NAME, 0), rpm_getstr(TAG_PREFIXS, 0) ? rpm_getstr(TAG_PREFIXS, 0) : "(not relocateable)");
printf("Version : %-34sVendor: %s\n", rpm_getstr(TAG_VERSION, 0), rpm_getstr(TAG_VENDOR, 0) ? rpm_getstr(TAG_VENDOR, 0) : "(none)");
bdate_time = rpm_getint(TAG_BUILDTIME, 0);
- bdate = localtime((time_t *) &bdate_time);
- strftime(bdatestring, 50, "%a %d %b %Y %T %Z", bdate);
+ bdate_ptm = localtime(&bdate_time);
+ strftime(bdatestring, 50, "%a %d %b %Y %T %Z", bdate_ptm);
printf("Release : %-30sBuild Date: %s\n", rpm_getstr(TAG_RELEASE, 0), bdatestring);
printf("Install date: %-30sBuild Host: %s\n", "(not installed)", rpm_getstr(TAG_BUILDHOST, 0));
printf("Group : %-30sSource RPM: %s\n", rpm_getstr(TAG_GROUP, 0), rpm_getstr(TAG_SOURCERPM, 0));