Removing dlsym calls from src/transport.c.  They became unnecessary
because wrap.c now uses _dl_sym to resolve functions as they are
used.
@@ -34,16 +34,6 @@ struct _transport_t
int fd;
} file;
};
-
- // These fields are used to avoid infinite recursion since we call
- // write and sendto from write and sendto.
- //
- // We *could* remove them and use fields from g_fn from wrap.c instead.
- // However, I don't want to do this because it would create a dependency
- // from transport to wrap. (A dep the other way is fine)
- ssize_t (*write)(int, const void *, size_t);
- ssize_t (*sendto)(int, const void *, size_t, int,
- const struct sockaddr *, socklen_t);
};
transport_t*
@@ -175,15 +165,10 @@ transportSend(transport_t* t, const char* msg)
{
if (!t || !msg) return -1;
- // Use these to avoid infinite recursion...
- if (!t->write) t->write = dlsym(RTLD_NEXT, "write");
- if (!t->sendto) t->sendto = dlsym(RTLD_NEXT, "sendto");
- if (!t->write || !t->sendto) return -1;
-
switch (t->type) {
case CFG_UDP:
if (t->udp.sock != -1) {
- int rc = t->sendto(t->udp.sock, msg, strlen(msg), 0,
+ int rc = sendto(t->udp.sock, msg, strlen(msg), 0,
(struct sockaddr *)&t->udp.saddr, sizeof(t->udp.saddr));
if (rc < 0) {
switch (errno) {
@@ -198,7 +183,7 @@ transportSend(transport_t* t, const char* msg)
break;
case CFG_FILE:
if (t->file.fd != -1) {
- int bytes = t->write(t->file.fd, msg, strlen(msg));
+ int bytes = write(t->file.fd, msg, strlen(msg));
if (bytes < 0) {
// TBD do something here
} else {
