1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

tsocket: we return -1 on error, not fd

the code used this pattent:

 if (fd < 0) {
   ...various cleanups...
   return fd;
 } 

it is much clearer to do this:

 if (fd < 0) {
   ...various cleanups...
   return -1;
 } 

as otherwise when reading the code you think this function may return
a fd.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andrew Tridgell 2010-09-15 11:21:43 +10:00
parent 0009d1771a
commit 0212800de8

View File

@ -1237,12 +1237,12 @@ static int tdgram_bsd_dgram_socket(const struct tsocket_address *local,
fd = socket(sa_fam, SOCK_DGRAM, 0);
if (fd < 0) {
return fd;
return -1;
}
fd = tsocket_bsd_common_prepare_fd(fd, true);
if (fd < 0) {
return fd;
return -1;
}
dgram = tdgram_context_create(mem_ctx,
@ -1270,7 +1270,7 @@ static int tdgram_bsd_dgram_socket(const struct tsocket_address *local,
int saved_errno = errno;
talloc_free(dgram);
errno = saved_errno;
return ret;
return -1;
}
}
#endif
@ -1284,7 +1284,7 @@ static int tdgram_bsd_dgram_socket(const struct tsocket_address *local,
int saved_errno = errno;
talloc_free(dgram);
errno = saved_errno;
return ret;
return -1;
}
}
@ -1297,7 +1297,7 @@ static int tdgram_bsd_dgram_socket(const struct tsocket_address *local,
int saved_errno = errno;
talloc_free(dgram);
errno = saved_errno;
return ret;
return -1;
}
}
@ -1307,7 +1307,7 @@ static int tdgram_bsd_dgram_socket(const struct tsocket_address *local,
int saved_errno = errno;
talloc_free(dgram);
errno = saved_errno;
return ret;
return -1;
}
}
@ -1323,7 +1323,7 @@ static int tdgram_bsd_dgram_socket(const struct tsocket_address *local,
int saved_errno = errno;
talloc_free(dgram);
errno = saved_errno;
return ret;
return -1;
}
}