libbsd: Branch 'main'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 29 13:18:42 UTC 2022


 test/fpurge.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 87b13070409f54360a7e658a425770265075f25e
Author: Duncan Overbruck <mail at duncano.de>
Date:   Tue Jan 25 20:34:39 2022 +0100

    test: Add fpurge() test case using open_memstream(3) FILE
    
    Signed-off-by: Guillem Jover <guillem at hadrons.org>

diff --git a/test/fpurge.c b/test/fpurge.c
index 1118f23..be6a593 100644
--- a/test/fpurge.c
+++ b/test/fpurge.c
@@ -25,11 +25,15 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 int
 main(int argc, char *argv[])
 {
 	FILE *fp;
+	char *buf = NULL;
+	size_t bufsz = 0;
 
 	if (fpurge(NULL) == 0)
 		return 1;
@@ -40,5 +44,14 @@ main(int argc, char *argv[])
 
 	fclose(fp);
 
+	fp = open_memstream(&buf, &bufsz);
+	fputs("World", fp);
+	if (fpurge(fp) < 0)
+		return 1;
+	fflush(fp);
+	if (bufsz != 0)
+		return 1;
+	free(buf);
+
 	return 0;
 }


More information about the libbsd mailing list