[cygutils - Chuck Wilson's collection of Cygwin utilities] branch master, updated. v1_4_16-10-gecb7644
Mark Geisert via Cygwin-apps-cvs <[email protected]>
| Newsgroups | gmane.os.cygwin.cvs.apps |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygutils.git;h=ecb76449ca233873d01feacd3dfd22cbf7e95e34 commit ecb76449ca233873d01feacd3dfd22cbf7e95e34 Author: Mark Geisert <[email protected]> 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)