[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 2/2] HACK: define NBD_SERVER_DEBUG to force maliciou
From: |
Eric Blake |
Subject: |
[Qemu-block] [PATCH 2/2] HACK: define NBD_SERVER_DEBUG to force malicious server |
Date: |
Thu, 10 Aug 2017 21:37:58 -0500 |
---
nbd/server.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/nbd/server.c b/nbd/server.c
index 82a78bf439..d6fbd46370 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -919,6 +919,17 @@ static int nbd_send_reply(QIOChannel *ioc, NBDReply
*reply, Error **errp)
stl_be_p(buf + 4, reply->error);
stq_be_p(buf + 8, reply->handle);
+ static int debug;
+ static int count;
+ if (!count++) {
+ const char *str = getenv("NBD_SERVER_DEBUG");
+ if (str) {
+ debug = atoi(str);
+ }
+ }
+ if (debug && !(count % debug)) {
+ buf[0] = 0;
+ }
return nbd_write(ioc, buf, sizeof(buf), errp);
}
--
2.13.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-block] [PATCH 2/2] HACK: define NBD_SERVER_DEBUG to force malicious server,
Eric Blake <=