[PATCH] ctdb: Fix a 32-bit problem

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Sep 4 14:42:53 UTC 2015


Hi!

On Fri, Sep 04, 2015 at 01:45:09PM +0200, Jérémie Courrèges-Anglas wrote:
> I am mildly concerned with this approach.  At least two
> implementations out there use 64 bits time_t on 32 bits (and 64 bits)
> systems: NetBSD, OpenBSD.  Linux x32 also uses 64 bits time_t.

Attached find a few more of the same. Is this more in line
what you have in mind?

Others: Review&push appreciated!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 3b24171f3dbc9e942f27dbc4a32af0b84a8ce6e1 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 4 Sep 2015 16:40:25 +0200
Subject: [PATCH] libsmbclient: Fix 32-bit problems

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 examples/libsmbclient/teststat.c  | 16 ++++++++--------
 examples/libsmbclient/teststat2.c | 16 ++++++++--------
 examples/libsmbclient/testutime.c | 16 ++++++++--------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/examples/libsmbclient/teststat.c b/examples/libsmbclient/teststat.c
index f36639e..4084fd0 100644
--- a/examples/libsmbclient/teststat.c
+++ b/examples/libsmbclient/teststat.c
@@ -47,10 +47,10 @@ int main(int argc, char * argv[])
         return 1;
     }
     
-    printf("\nSAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-           st.st_mtime, ctime_r(&st.st_mtime, m_time),
-           st.st_ctime, ctime_r(&st.st_ctime, c_time),
-           st.st_atime, ctime_r(&st.st_atime, a_time)); 
+    printf("\nSAMBA\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
+           (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
+           (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
+           (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
     
     if (pLocalPath != NULL)
     {
@@ -60,10 +60,10 @@ int main(int argc, char * argv[])
             return 1;
         }
         
-        printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-               st.st_mtime, ctime_r(&st.st_mtime, m_time),
-               st.st_ctime, ctime_r(&st.st_ctime, c_time),
-               st.st_atime, ctime_r(&st.st_atime, a_time)); 
+        printf("LOCAL\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
+               (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
+               (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
+               (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
     }
 
     return 0; 
diff --git a/examples/libsmbclient/teststat2.c b/examples/libsmbclient/teststat2.c
index fcd3e30..963cd27 100644
--- a/examples/libsmbclient/teststat2.c
+++ b/examples/libsmbclient/teststat2.c
@@ -47,10 +47,10 @@ static int gettime(const char * pUrl,
                 return 1;
         }
         
-        printf("SAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-               st.st_mtime, ctime_r(&st.st_mtime, m_time),
-               st.st_ctime, ctime_r(&st.st_ctime, c_time),
-               st.st_atime, ctime_r(&st.st_atime, a_time)); 
+        printf("SAMBA\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
+               (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
+               (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
+               (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
         
         
         /* check the stat on this file */
@@ -60,10 +60,10 @@ static int gettime(const char * pUrl,
                 return 1;
         }
         
-        printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-               st.st_mtime, ctime_r(&st.st_mtime, m_time),
-               st.st_ctime, ctime_r(&st.st_ctime, c_time),
-               st.st_atime, ctime_r(&st.st_atime, a_time));
+        printf("LOCAL\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
+               (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
+               (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
+               (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
         
         
         return 0;
diff --git a/examples/libsmbclient/testutime.c b/examples/libsmbclient/testutime.c
index 2b3c40b..cdbcfec 100644
--- a/examples/libsmbclient/testutime.c
+++ b/examples/libsmbclient/testutime.c
@@ -47,10 +47,10 @@ int main(int argc, char * argv[])
         return 1;
     }
     
-    printf("Before\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-           st.st_mtime, ctime_r(&st.st_mtime, m_time),
-           st.st_ctime, ctime_r(&st.st_ctime, c_time),
-           st.st_atime, ctime_r(&st.st_atime, a_time)); 
+    printf("Before\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
+           (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
+           (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
+           (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
     
     utimbuf.actime = t;         /* unchangable (wont change) */
     utimbuf.modtime = t;        /* this one should succeed */
@@ -66,10 +66,10 @@ int main(int argc, char * argv[])
         return 1;
     }
     
-    printf("After\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
-           st.st_mtime, ctime_r(&st.st_mtime, m_time),
-           st.st_ctime, ctime_r(&st.st_ctime, c_time),
-           st.st_atime, ctime_r(&st.st_atime, a_time)); 
+    printf("After\n mtime:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
+           (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
+           (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
+           (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
     
     return 0; 
 }
-- 
1.9.1



More information about the samba-technical mailing list