[PATCH 1/2] nbd-client: Fix use without -N
The refactoring in commit 17043b068 causes nbd-client without -N to
segfault, instead of using the desired default export.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
.gitignore | 1 +
nbd-client.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 048c6fd0..94752d22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@ manpage.links
mkinstalldirs
nbd-tester-client
nbd-client
+nbd-get-status
nbd-server
nbd-trplay
doc/doxygen-output
diff --git a/nbd-client.c b/nbd-client.c
index 06d1440f..e9a42009 100644
--- a/nbd-client.c
+++ b/nbd-client.c
@@ -1182,7 +1182,9 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
- if((!cur_client->name || strlen(cur_client->name)==0) && !(opts & NBDC_DO_LIST)) {
+ if(!cur_client->name)
+ cur_client->name = "";
+ if((strlen(cur_client->name)==0) && !(opts & NBDC_DO_LIST)) {
printf("Warning: the oldstyle protocol is no longer supported.\nThis method now uses the newstyle protocol with a default export\n");
}
--
2.47.0
Reply to: