public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [cygutils - Chuck Wilson's collection of Cygwin utilities] branch master, updated. v1_4_16-10-gecb7644
@ 2021-11-05  8:45 Mark Geisert
  0 siblings, 0 replies; only message in thread
From: Mark Geisert @ 2021-11-05  8:45 UTC (permalink / raw)
  To: cygwin-apps-cvs




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)



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-05  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05  8:45 [cygutils - Chuck Wilson's collection of Cygwin utilities] branch master, updated. v1_4_16-10-gecb7644 Mark Geisert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).