Proper check for success of `get_xsockets'

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1478 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-03-23 05:02:51 +00:00
parent 92b5a08e81
commit 611158196d
2 changed files with 11 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ childhandler (int sig)
do {
pid = waitpid (-1, &status, WNOHANG|WUNTRACED);
if (pid > 0 && WIFEXITED(status) || WIFSIGNALED(status))
if (pid > 0 && (WIFEXITED(status) || WIFSIGNALED(status)))
if (--nchild == 0 && donep)
exit (0);
} while(pid > 0);
@@ -397,11 +397,13 @@ doit_active (char *host, char *user, int debugpp, int tcpp, int port)
des_key_schedule schedule;
des_cblock key;
int rendez_vous1 = 0, rendez_vous2 = 0;
int tmp;
display_num = get_xsockets (&rendez_vous1,
tcpp ? &rendez_vous2 : NULL);
if (display_num < 0)
tmp = get_xsockets (&rendez_vous1,
tcpp ? &rendez_vous2 : NULL);
if (tmp < 0)
return 1;
display_num = tmp;
strncpy(xauthfile, tempnam("/tmp", NULL), xauthfile_size);
if (create_and_write_cookie (xauthfile, cookie, cookie_len))
return 1;

View File

@@ -258,9 +258,12 @@ doit(int sock, int tcpp)
if (krb_net_read (sock, &passivep, sizeof(passivep)) != sizeof(passivep))
return 1;
if (passivep) {
display_num = get_xsockets (&localx, tcpp ? &tcpx : NULL);
if (display_num < 0)
int tmp;
tmp = get_xsockets (&localx, tcpp ? &tcpx : NULL);
if (tmp < 0)
return 1;
display_num = tmp;
if (tcpp)
sprintf (display, "localhost:%u", display_num);
else