summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-15 11:21:43 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-15 15:39:36 +1000
commit0212800de8c6367c9da7939fc43a1fa23c7da2bf (patch)
tree1a6f1281cc46b41ec8edcc4d1c239c115a99dfa0 /lib
parent0009d1771a757c1df152693840991ecc57564f34 (diff)
downloadsamba-0212800de8c6367c9da7939fc43a1fa23c7da2bf.tar.gz
samba-0212800de8c6367c9da7939fc43a1fa23c7da2bf.tar.bz2
samba-0212800de8c6367c9da7939fc43a1fa23c7da2bf.zip
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/tsocket/tsocket_bsd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index dfc9685bc9..dabf962e87 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -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;
}
}