Skip to content

fix confusing error report of connect#30

Open
jjqq2013 wants to merge 1 commit intofujita:masterfrom
jjqq2013:master
Open

fix confusing error report of connect#30
jjqq2013 wants to merge 1 commit intofujita:masterfrom
jjqq2013:master

Conversation

@jjqq2013
Copy link

There is a confusing error message when failed to connect to tgtd unix domain socket, it could not check the error,
instead, it just continue to call write, which in turn cause error failed to send request hdr to tgt daemon, Transport endpoint is not connected.

	err = ipc_mgmt_connect(&fd);
	if (err < 0) {

When ipc_mgmt_connect failed, it returns errno as err, so the err will be a positive value, so when error happens, this check does not works.

		eprintf("can't connect to tgt daemon, %m\n");
		goto out;
	}

	err = write(fd, req, sizeof(*req));

In fact, it should report error when connect: can't connect to tgt daemon, THE REAL REASON

There is a confusing error message when failed to connect to tgtd unix domain socket, it could not check the error, 
instead, it just continue to call write, which in turn cause error `failed to send request hdr to tgt daemon, Transport endpoint is not connected`.

```
	err = ipc_mgmt_connect(&fd);
	if (err < 0) {
```

When ipc_mgmt_connect failed, it returns errno as err, so the err will be a positive value, so when error happens, this check does not works.

```
		eprintf("can't connect to tgt daemon, %m\n");
		goto out;
	}

	err = write(fd, req, sizeof(*req));
```

In fact, it should report error when connect: `can't connect to tgt daemon, THE REAL REASON`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant