diff --git a/criu/sk-unix.c b/criu/sk-unix.c index 2291fdecfc..ab76a659cd 100644 --- a/criu/sk-unix.c +++ b/criu/sk-unix.c @@ -977,6 +977,9 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui) int cwd_fd = -1, root_fd = -1; int ret = -1; + if (ui->ue->name.len == 0) + return 0; + if ((ui->ue->type == SOCK_STREAM) && (ui->ue->state == TCP_ESTABLISHED)) { /* * FIXME this can be done, but for doing this properly we @@ -1369,6 +1372,8 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base, struct cr_img *i) { struct unix_sk_info *ui = o; static bool post_queued = false; + char *uname; + int ulen; ui->ue = pb_msg(base, UnixSkEntry); ui->name_dir = (void *)ui->ue->name_dir; @@ -1398,9 +1403,20 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base, struct cr_img *i) INIT_LIST_HEAD(&ui->connected); INIT_LIST_HEAD(&ui->node); ui->flags = 0; - pr_info(" `- Got %#x peer %#x (name %s dir %s)\n", + + uname = ui->name; + ulen = ui->ue->name.len; + if (ulen > 0 && uname[0] == 0) { + uname++; + ulen--; + } else if (ulen == 0) { + ulen = 1; + uname = "-"; + } + + pr_info(" `- Got %#x peer %#x (name %.*s dir %s)\n", ui->ue->ino, ui->ue->peer, - ui->name ? (ui->name[0] ? ui->name : &ui->name[1]) : "-", + ulen, uname, ui->name_dir ? ui->name_dir : "-"); list_add_tail(&ui->list, &unix_sockets); return file_desc_add(&ui->d, ui->ue->id, &unix_desc_ops);