Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix confusing error report of connect #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix confusing error report of connect #30

wants to merge 1 commit into from

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