[cygutils - Chuck Wilson's collection of Cygwin utilities] branch master, updated. v1_4_16-10-gecb7644

Mark Geisert mgeisert@sourceware.org
Fri Nov 5 08:45:10 GMT 2021




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygutils.git;h=ecb76449ca233873d01feacd3dfd22cbf7e95e34

commit ecb76449ca233873d01feacd3dfd22cbf7e95e34
Author: Mark Geisert <mark@maxrnd.com>
Date:   Fri Nov 5 01:45:01 2021 -0700

    Add missing 32/64 timespec expansion


Diff:
---
 src/clip/putclip.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/clip/putclip.c b/src/clip/putclip.c
index 13158bd..fb54416 100644
--- a/src/clip/putclip.c
+++ b/src/clip/putclip.c
@@ -563,8 +563,16 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
       if (cygNewFormat == 2)
         {
           cygcb_t *clipbufX = (cygcb_t *) clipbuf;
-          clipbufX->cb_size = convlen;
           clock_gettime (CLOCK_REALTIME, &clipbufX->ts);
+#ifdef __x86_64__
+          /* ts overlays cb_sec and cb_nsec such that no conversion is needed */
+#elif __i386__
+          /* Expand 32-bit timespec layout to 64-bit layout.
+             NOTE: Steps must be done in this order to avoid data loss. */
+          clipbufX->cb_nsec = clipbufX->ts.tv_nsec;
+          clipbufX->cb_sec  = clipbufX->ts.tv_sec;
+#endif
+          clipbufX->cb_size = convlen;
           memcpy (&clipbufX[1], convbuf, convlen);
         }
       else if (cygNewFormat == 1)



More information about the Cygwin-apps-cvs mailing list