##// 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 /* real connect */
458 /* real connect */
459 int r = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
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 if (bakfd != -1) {
464 if (bakfd != -1) {
461 fchdirx(bakfd);
465 fchdirx(bakfd);
462 close(bakfd);
466 close(bakfd);
463 }
467 }
464
465 if (r < 0) {
468 if (r < 0) {
466 close(fd);
469 close(fd);
467 if (errno == ENOENT || errno == ECONNREFUSED)
470 return NULL;
468 return NULL;
469 abortmsgerrno("cannot connect to %s", addr.sun_path);
470 }
471 }
471 debugmsg("connected to %s", addr.sun_path);
472 debugmsg("connected to %s", addr.sun_path);
472
473
General Comments 0
You need to be logged in to leave comments. Login now