public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jon TURNEY <jturney@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: testsuite: Fix size of write to temporary file to be mmap()ed
Date: Mon, 29 Aug 2022 16:54:46 +0000 (GMT)	[thread overview]
Message-ID: <20220829165446.6FABD3857B9B@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f1d7ef46f77ff0145b3923effe4c71b67072731d

commit f1d7ef46f77ff0145b3923effe4c71b67072731d
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Nov 26 16:11:44 2020 +0000

    Cygwin: testsuite: Fix size of write to temporary file to be mmap()ed
    
    See ltp commit 91361378

Diff:
---
 winsup/testsuite/winsup.api/ltp/mmap02.c | 2 +-
 winsup/testsuite/winsup.api/ltp/mmap03.c | 2 +-
 winsup/testsuite/winsup.api/ltp/mmap04.c | 2 +-
 winsup/testsuite/winsup.api/ltp/mmap05.c | 3 +--
 winsup/testsuite/winsup.api/ltp/mmap06.c | 2 +-
 winsup/testsuite/winsup.api/ltp/mmap07.c | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/winsup/testsuite/winsup.api/ltp/mmap02.c b/winsup/testsuite/winsup.api/ltp/mmap02.c
index 33a12738c..b96bdb452 100644
--- a/winsup/testsuite/winsup.api/ltp/mmap02.c
+++ b/winsup/testsuite/winsup.api/ltp/mmap02.c
@@ -225,7 +225,7 @@ setup()
 	}
 
 	/* Write test buffer contents into temporary file */
-	if (write(fildes, tst_buff, sizeof(tst_buff)) < (int)sizeof(tst_buff)) {
+	if (write(fildes, tst_buff, page_sz) < page_sz) {
 		tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s",
 			 TEMPFILE, errno, strerror(errno));
 		free(tst_buff);
diff --git a/winsup/testsuite/winsup.api/ltp/mmap03.c b/winsup/testsuite/winsup.api/ltp/mmap03.c
index 9302d335d..fba512c28 100644
--- a/winsup/testsuite/winsup.api/ltp/mmap03.c
+++ b/winsup/testsuite/winsup.api/ltp/mmap03.c
@@ -225,7 +225,7 @@ setup()
 	}
 
 	/* Write test buffer contents into temporary file */
-	if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) {
+	if (write(fildes, tst_buff, page_sz) < page_sz) {
 		tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s",
 			 TEMPFILE, errno, strerror(errno));
 		free(tst_buff);
diff --git a/winsup/testsuite/winsup.api/ltp/mmap04.c b/winsup/testsuite/winsup.api/ltp/mmap04.c
index 64d3a8ebe..dbe25aefd 100644
--- a/winsup/testsuite/winsup.api/ltp/mmap04.c
+++ b/winsup/testsuite/winsup.api/ltp/mmap04.c
@@ -225,7 +225,7 @@ setup()
 	}
 
 	/* Write test buffer contents into temporary file */
-	if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) {
+	if (write(fildes, tst_buff, page_sz) < page_sz) {
 		tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s",
 			 TEMPFILE, errno, strerror(errno));
 		free(tst_buff);
diff --git a/winsup/testsuite/winsup.api/ltp/mmap05.c b/winsup/testsuite/winsup.api/ltp/mmap05.c
index bcdfd0cd8..6e75ee222 100644
--- a/winsup/testsuite/winsup.api/ltp/mmap05.c
+++ b/winsup/testsuite/winsup.api/ltp/mmap05.c
@@ -228,8 +228,7 @@ setup()
 	}
 
 	/* Write test buffer contents into temporary file */
-	if (write(fildes, tst_buff, strlen(tst_buff))
-	    != (int)strlen(tst_buff)) {
+	if (write(fildes, tst_buff, page_sz) != page_sz) {
 		tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s",
 			 TEMPFILE, errno, strerror(errno));
 		free(tst_buff);
diff --git a/winsup/testsuite/winsup.api/ltp/mmap06.c b/winsup/testsuite/winsup.api/ltp/mmap06.c
index ec113c077..c099f8c33 100644
--- a/winsup/testsuite/winsup.api/ltp/mmap06.c
+++ b/winsup/testsuite/winsup.api/ltp/mmap06.c
@@ -197,7 +197,7 @@ setup()
 	}
 
 	/* Write test buffer contents into temporary file */
-	if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) {
+	if (write(fildes, tst_buff, page_sz) < page_sz) {
 		tst_brkm(TFAIL, NULL,
 			 "write() on %s Failed, errno=%d : %s",
 			 TEMPFILE, errno, strerror(errno));
diff --git a/winsup/testsuite/winsup.api/ltp/mmap07.c b/winsup/testsuite/winsup.api/ltp/mmap07.c
index ab989f443..6e3bb5112 100644
--- a/winsup/testsuite/winsup.api/ltp/mmap07.c
+++ b/winsup/testsuite/winsup.api/ltp/mmap07.c
@@ -198,7 +198,7 @@ setup()
 	}
 
 	/* Write test buffer contents into temporary file */
-	if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) {
+	if (write(fildes, tst_buff, page_sz) < page_sz) {
 		tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s",
 			 TEMPFILE, errno, strerror(errno));
 		free(tst_buff);

                 reply	other threads:[~2022-08-29 16:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220829165446.6FABD3857B9B@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).