Skip to content

Commit a78ea37

Browse files
committed
nbd-client: Fix use without -N
The refactoring in commit 17043b0 causes nbd-client without -N to segfault, instead of using the desired default export. Signed-off-by: Eric Blake <eblake@redhat.com>
1 parent cf5a774 commit a78ea37

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ manpage.links
1818
mkinstalldirs
1919
nbd-tester-client
2020
nbd-client
21+
nbd-get-status
2122
nbd-server
2223
nbd-trplay
2324
doc/doxygen-output

nbd-client.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,9 @@ int main(int argc, char *argv[]) {
11861186
exit(EXIT_FAILURE);
11871187
}
11881188

1189-
if((!cur_client->name || strlen(cur_client->name)==0) && !(opts & NBDC_DO_LIST)) {
1189+
if(!cur_client->name)
1190+
cur_client->name = "";
1191+
if((strlen(cur_client->name)==0) && !(opts & NBDC_DO_LIST)) {
11901192
printf("Warning: the oldstyle protocol is no longer supported.\nThis method now uses the newstyle protocol with a default export\n");
11911193
}
11921194

0 commit comments

Comments
 (0)