diff options
-rw-r--r-- | emulator/tools/qemu-props.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/emulator/tools/qemu-props.c b/emulator/tools/qemu-props.c index 09105fc..3f086a1 100644 --- a/emulator/tools/qemu-props.c +++ b/emulator/tools/qemu-props.c @@ -80,12 +80,13 @@ int main(void) for (;;) { #define BUFF_SIZE (PROPERTY_KEY_MAX + PROPERTY_VALUE_MAX + 2) - + DD("receiving.."); char* q; char temp[BUFF_SIZE]; int len = qemud_channel_recv(qemud_fd, temp, sizeof temp - 1); - if (len < 0 || len > BUFF_SIZE-1) + /* lone NUL-byte signals end of properties */ + if (len < 0 || len > BUFF_SIZE-1 || temp[0] == '\0') break; temp[len] = '\0'; /* zero-terminate string */ @@ -107,6 +108,7 @@ int main(void) } } + /* finally, close the channel and exit */ close(qemud_fd); DD("exiting (%d properties set).", count); |