##// END OF EJS Templates
chg: handle connect failure before errno gets overridden...
Jun Wu -
r30679:fe11f466 default
parent child Browse files
Show More
@@ -457,16 +457,17 b' hgclient_t *hgc_open(const char *socknam'
457 457
458 458 /* real connect */
459 459 int r = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
460 if (r < 0) {
461 if (errno != ENOENT && errno != ECONNREFUSED)
462 abortmsgerrno("cannot connect to %s", sockname);
463 }
460 464 if (bakfd != -1) {
461 465 fchdirx(bakfd);
462 466 close(bakfd);
463 467 }
464
465 468 if (r < 0) {
466 469 close(fd);
467 if (errno == ENOENT || errno == ECONNREFUSED)
468 return NULL;
469 abortmsgerrno("cannot connect to %s", addr.sun_path);
470 return NULL;
470 471 }
471 472 debugmsg("connected to %s", addr.sun_path);
472 473
General Comments 0
You need to be logged in to leave comments. Login now