Displaying 3 results from an estimated 3 matches for "stdio_config_complete".
2020 Aug 05
2
[PATCH nbdkit 1/2] server: Call .get_ready before redirecting stdin/stdout to /dev/null.
...user, fork, or open any sockets.
- */
configured = true;
- top->get_ready (top);
start_serving ();
diff --git a/tests/test-stdio-plugin.c b/tests/test-stdio-plugin.c
index 618eae83..86447278 100644
--- a/tests/test-stdio-plugin.c
+++ b/tests/test-stdio-plugin.c
@@ -122,6 +122,14 @@ stdio_config_complete (void)
static int
stdio_get_ready (void)
+{
+ bool check = stdio_check ();
+ assert (check == false);
+ return 0;
+}
+
+static int
+stdio_after_fork (void)
{
bool check = stdio_check ();
assert (check == true);
@@ -163,6 +171,7 @@ static struct nbdkit_plugin plugin = {
.config...
2020 Apr 14
0
[nbdkit PATCH v2 3/3] server: More tests of stdin/out handling
...The point of .dump_plugin is to extend details sent to stdout */
+ printf ("%s=%s\n", msg, buf);
+ free (buf);
+}
+
+static int
+stdio_config (const char *key, const char *value)
+{
+ bool check = stdio_check ();
+ assert (check == false);
+ msg = key;
+ return 0;
+}
+
+static int
+stdio_config_complete (void)
+{
+ bool check = stdio_check ();
+ assert (check == false);
+ if (nbdkit_stdio_safe ()) {
+ char *buf = NULL;
+ size_t len = 0;
+
+ /* Reading from stdin during .config_complete is safe except under -s */
+ if (getline (&buf, &len, stdin) == -1)
+ assert (false);...
2020 Apr 14
6
[nbdkit PATCH v2 0/3] more consistent stdin/out handling
In v2:
- use int instead of bool in the public header
- split the tests from the code
- don't overload test-layers; instead, add new tests
- add a missing fflush exposed by the new tests
- other minor cleanups
Eric Blake (3):
server: Add nbdkit_stdio_safe
server: Sanitize stdin/out before running plugin code
server: More tests of stdin/out handling
docs/nbdkit-plugin.pod |