summary refs log tree commit diff stats
path: root/qemu-nbd.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-05-18 20:04:54 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-05-18 20:04:54 +0100
commita89af8c20ab289785806fcc1589b0f4265bd4e90 (patch)
treeb99e7b51dfe483304e96068807147edb9d98f4a5 /qemu-nbd.c
parenta28c9c8c9fc42484efe1bf5a77affe842e54e38b (diff)
parentd8154b0945f795177511ea0e2212bd5c749fe84c (diff)
downloadfocaccia-qemu-a89af8c20ab289785806fcc1589b0f4265bd4e90.tar.gz
focaccia-qemu-a89af8c20ab289785806fcc1589b0f4265bd4e90.zip
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-05-18' into staging
nbd patches for 2020-05-20

- fix stranded fd in 'qemu-nbd -c /dev/nbd0'
- add 'qemu-img map --start-offset --max-length' options

# gpg: Signature made Mon 18 May 2020 17:29:56 BST
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2020-05-18:
  iotests: Enhance 223 to cover qemu-img map improvements
  qemu-img: Add --start-offset and --max-length to map
  qemu-img: refactor dump_map_entry JSON format output
  qemu-img: validate image length in img_map
  qemu_img: add cvtnum_full to print error reports
  qemu-nbd: Close inherited stderr

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-nbd.c')
-rw-r--r--qemu-nbd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 4aa005004e..306e44fb0a 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -916,7 +916,11 @@ int main(int argc, char **argv)
         } else if (pid == 0) {
             close(stderr_fd[0]);
 
-            old_stderr = dup(STDERR_FILENO);
+            /* Remember parent's stderr if we will be restoring it. */
+            if (fork_process) {
+                old_stderr = dup(STDERR_FILENO);
+            }
+
             ret = qemu_daemon(1, 0);
 
             /* Temporarily redirect stderr to the parent's pipe...  */