Change times in amq RPCs to be longlong_t instead master
authorChristos Zoulas <christos@zoulas.com>
Tue, 30 Aug 2022 15:16:34 +0000 (11:16 -0400)
committerChristos Zoulas <christos@zoulas.com>
Tue, 30 Aug 2022 15:16:34 +0000 (11:16 -0400)
of long, to avoid 2038 issue on 32 bit machines.
This makes the amq RPC incompatible with older versions
of amd. It is too much work to provide backwards compatibility
for little benefit, but it can be done.
Fix core-dump in amq -i.

ChangeLog
amd/amq_subr.c
amq/amq_xdr.c
include/amq_defs.h

index b09dc8a1482cc66f4b8ff012bc14d2bc7b71b765..ee73635026a9c091bf47b857cb2aff08d91a0c27 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-08-30  Christos Zoulas <christos@zoulas.com>
+
+       * Change times in amq RPCs to be longlong_t instead
+         of long, to avoid 2038 issue on 32 bit machines.
+         This makes the amq RPC incompatible with older versions
+         of amd. It is too much work to provide backwards compatibility
+         for little benefit, but it can be done.
+         Fix core-dump in amq -i.
+
 2016-04-08  Christos Zoulas <christos@zoulas.com>
 
        * Make hasmntval() return an 0 on error, 1 on success and
index 86f035186d72a83e446474985037b4414a1df533..31f32eabc34cf3c378cb4533a5d13c6a60e4aa77 100644 (file)
@@ -329,7 +329,7 @@ bool_t
 xdr_amq_mount_tree_node(XDR *xdrs, amq_mount_tree *objp)
 {
   am_node *mp = (am_node *) objp;
-  long mtime;
+  longlong_t mtime;
 
   if (!xdr_amq_string(xdrs, &mp->am_al->al_mnt->mf_info)) {
     return (FALSE);
@@ -344,7 +344,7 @@ xdr_amq_mount_tree_node(XDR *xdrs, amq_mount_tree *objp)
     return (FALSE);
   }
   mtime = mp->am_stats.s_mtime;
-  if (!xdr_long(xdrs, &mtime)) {
+  if (!xdr_longlong_t(xdrs, &mtime)) {
     return (FALSE);
   }
   if (!xdr_u_short(xdrs, &mp->am_stats.s_uid)) {
@@ -528,7 +528,7 @@ xdr_amq_map_info_qelem(XDR *xdrs, qelem *qhead)
   u_int len = 0;
   int x;
   char *n;
-  long modify;
+  longlong_t modify;
 
   /*
    * Compute length of list
@@ -553,8 +553,8 @@ xdr_amq_map_info_qelem(XDR *xdrs, qelem *qhead)
       return (FALSE);
     }
 
-    modify = (long)m->modify;
-    if (!xdr_long(xdrs, &modify)) {
+    modify = m->modify;
+    if (!xdr_longlong_t(xdrs, &modify)) {
       return (FALSE);
     }
 
index b9a1c20fbf1154c2e1346c10e8b5a462f4befc60..9409b8e35ce86024a00d8df0768c00abb8677cf8 100644 (file)
@@ -47,7 +47,7 @@
 bool_t
 xdr_time_type(XDR *xdrs, time_type *objp)
 {
-  if (!xdr_long(xdrs, (long *) objp)) {
+  if (!xdr_longlong_t(xdrs, (longlong_t *) objp)) {
     return (FALSE);
   }
   return (TRUE);
index 89f61805fc6093eba0e7a7462c8d57948c2e3724..ef4fd206b9f43b55704171536a405ca11ad389a9 100644 (file)
@@ -66,7 +66,7 @@
 /*
  * TYPEDEFS
  */
-typedef long *time_type;
+typedef long long time_type;
 typedef struct amq_mount_info amq_mount_info;
 typedef struct amq_map_info amq_map_info;
 typedef struct amq_mount_stats amq_mount_stats;