]> git.ipfire.org Git - people/ms/pakfire.git/blobdiff - tests/libpakfire/jail.c
jail: Implement sending data into standard input
[people/ms/pakfire.git] / tests / libpakfire / jail.c
index 2993448ca255e3877379592c1f18a811ef55ec9f..d49795a94680604107d074265390b3f2ca5d5095 100644 (file)
@@ -350,9 +350,14 @@ static int callback_stdin(struct pakfire* pakfire, void* data, int fd) {
        while (*lines > 0) {
                r = dprintf(fd, "LINE %d\n", *lines);
                if (r < 0) {
-                       LOG_ERROR("Could not write line (%u) to stdin: %m\n", *lines);
-
-                       return 1;
+                       switch (errno) {
+                               case EAGAIN:
+                                       return 0;
+
+                               default:
+                                       LOG_ERROR("Could not write line (%u) to stdin: %m\n", *lines);
+                                       return -errno;
+                       }
                }
 
                // Decrement the lines counter