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

CFE-4414: cf-net connect now exits with 1 in case of error #5673

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cf-net/cf-net.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ static int CFNetRun(CFNetOptions *opts, char **args, char *hostnames)
int ret = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So ret was not set to anything else than 0 before? Weird that we haven't been getting any warning/errors for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess because we return ret in the end.

char *hostname = strtok(hosts, ",");
while (hostname != NULL){
CFNetCommandSwitch(opts, hostname, args, cmd);
if (CFNetCommandSwitch(opts, hostname, args, cmd) != 0) {
ret = -1;
craigcomstock marked this conversation as resolved.
Show resolved Hide resolved
}
hostname = strtok(NULL, ",");
}
free(hosts);
Expand Down Expand Up @@ -636,8 +638,7 @@ static int CFNetConnect(const char *hostname, const char *use_protocol_version,
Log(LOG_LEVEL_ERR, "No hostname specified");
return -1;
}
CFNetConnectSingle(hostname, use_protocol_version, true);
return 0;
return CFNetConnectSingle(hostname, use_protocol_version, true);
}

static void CFNetDisconnect(AgentConnection *conn)
Expand Down
Loading