[Pkg-libvirt-commits] [libguestfs] 03/14: log: Pass correct parameter to localtime_r on 32 bit platforms.

Hilko Bengen bengen at moszumanska.debian.org
Sat Aug 30 08:29:25 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag upstream/1.27.21
in repository libguestfs.

commit 2369e9c2d660e1b9010b5c0afc599b769efd08b2
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Wed Jul 2 16:24:59 2014 +0100

    log: Pass correct parameter to localtime_r on 32 bit platforms.
    
    We were passing an int64_t which happens to be the same as time_t, but
    only on 64 bit.  This didn't work on 32 bit (or rather, it works on
    little endian, but only by accident).
    
    This fixes commit fb546eaee064b14ad192a4f0390325ba1b4c766a.
---
 cat/log.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cat/log.c b/cat/log.c
index 9a556a8..374efa7 100644
--- a/cat/log.c
+++ b/cat/log.c
@@ -345,11 +345,11 @@ do_log_journal (void)
     /* Timestamp. */
     if (ts >= 0) {
       char buf[64];
+      time_t t = ts / 1000000;
       struct tm tm;
 
-      ts /= 1000000;
       if (strftime (buf, sizeof buf, "%b %d %H:%M:%S",
-                    localtime_r (&ts, &tm)) <= 0) {
+                    localtime_r (&t, &tm)) <= 0) {
         fprintf (stderr, _("%s: could not format journal entry timestamp\n"),
                  program_name);
         errors++;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list