summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-01 17:31:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-01 17:31:40 +0000
commitc2880b20167da79a7f9677925364699cadf9274d (patch)
tree87b8c219c8b2a0bcdd7e2dd190ae96f42e5b7561
parent3e8af80c5474d7f8af10c262c90002f55ce630bd (diff)
Remove calls to perror(); the error returns are sufficient, and these
library may not assume stderr is useable. ok millert miod beck
-rw-r--r--lib/libc/rpc/svc_run.c4
-rw-r--r--lib/libc/rpc/svc_tcp.c7
-rw-r--r--lib/libc/rpc/svc_udp.c23
3 files changed, 7 insertions, 27 deletions
diff --git a/lib/libc/rpc/svc_run.c b/lib/libc/rpc/svc_run.c
index 25664938105..340440031fe 100644
--- a/lib/libc/rpc/svc_run.c
+++ b/lib/libc/rpc/svc_run.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_run.c,v 1.24 2014/11/05 21:06:51 sthen Exp $ */
+/* $OpenBSD: svc_run.c,v 1.25 2015/09/01 17:31:39 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -53,7 +53,6 @@ svc_run(void)
newp = reallocarray(pfd, svc_max_pollfd, sizeof(*pfd));
if (newp == NULL) {
free(pfd);
- perror("svc_run"); /* XXX */
return; /* XXX */
}
saved_max_pollfd = svc_max_pollfd;
@@ -66,7 +65,6 @@ svc_run(void)
case -1:
if (errno == EINTR)
continue;
- perror("svc_run: - poll failed"); /* XXX */
free(pfd);
return; /* XXX */
case 0:
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c
index efe4795e4d2..f30911d23dc 100644
--- a/lib/libc/rpc/svc_tcp.c
+++ b/lib/libc/rpc/svc_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_tcp.c,v 1.33 2014/10/25 03:18:58 lteo Exp $ */
+/* $OpenBSD: svc_tcp.c,v 1.34 2015/09/01 17:31:39 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -134,10 +134,8 @@ svctcp_create(int sock, u_int sendsize, u_int recvsize)
socklen_t len = sizeof(struct sockaddr_in);
if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
- perror("svctcp_.c - udp socket creation problem");
+ if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
return (NULL);
- }
madesock = TRUE;
}
memset(&addr, 0, sizeof (addr));
@@ -149,7 +147,6 @@ svctcp_create(int sock, u_int sendsize, u_int recvsize)
}
if ((getsockname(sock, (struct sockaddr *)&addr, &len) != 0) ||
(listen(sock, 2) != 0)) {
- perror("svctcp_.c - cannot getsockname or listen");
if (madesock)
(void)close(sock);
return (NULL);
diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c
index 4c974ff0cd9..6a889e17d20 100644
--- a/lib/libc/rpc/svc_udp.c
+++ b/lib/libc/rpc/svc_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_udp.c,v 1.21 2015/08/20 21:49:29 deraadt Exp $ */
+/* $OpenBSD: svc_udp.c,v 1.22 2015/09/01 17:31:39 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -104,10 +104,8 @@ svcudp_bufcreate(int sock, u_int sendsz, u_int recvsz)
socklen_t len = sizeof(struct sockaddr_in);
if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- perror("svcudp_create: socket creation problem");
+ if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
return (NULL);
- }
madesock = TRUE;
}
memset(&addr, 0, sizeof (addr));
@@ -118,7 +116,6 @@ svcudp_bufcreate(int sock, u_int sendsz, u_int recvsz)
(void)bind(sock, (struct sockaddr *)&addr, len);
}
if (getsockname(sock, (struct sockaddr *)&addr, &len) != 0) {
- perror("svcudp_create - cannot getsockname");
if (madesock)
(void)close(sock);
return (NULL);
@@ -278,9 +275,6 @@ svcudp_destroy(SVCXPRT *xprt)
#define SPARSENESS 4 /* 75% sparse */
-#define CACHE_PERROR(msg) \
- (void) fprintf(stderr,"%s\n", msg)
-
/*
* An entry in the cache
*/
@@ -337,26 +331,20 @@ svcudp_enablecache(SVCXPRT *transp, u_long size)
struct svcudp_data *su = su_data(transp);
struct udp_cache *uc;
- if (su->su_cache != NULL) {
- CACHE_PERROR("enablecache: cache already enabled");
+ if (su->su_cache != NULL)
return(0);
- }
uc = malloc(sizeof(*uc));
- if (uc == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache");
+ if (uc == NULL)
return(0);
- }
uc->uc_size = size;
uc->uc_nextvictim = 0;
if (size > SIZE_MAX / (sizeof(cache_ptr) * SPARSENESS) ||
(uc->uc_entries = calloc(size, sizeof(cache_ptr) * SPARSENESS)) == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache data");
free(uc);
return(0);
}
uc->uc_fifo = calloc(sizeof(cache_ptr), size);
if (uc->uc_fifo == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache fifo");
free(uc->uc_entries);
free(uc);
return(0);
@@ -391,7 +379,6 @@ cache_set(SVCXPRT *xprt, u_long replylen)
vicp = &(*vicp)->cache_next)
;
if (*vicp == NULL) {
- CACHE_PERROR("cache_set: victim not found");
return;
}
*vicp = victim->cache_next; /* remote from cache */
@@ -399,12 +386,10 @@ cache_set(SVCXPRT *xprt, u_long replylen)
} else {
victim = malloc(sizeof(struct cache_node));
if (victim == NULL) {
- CACHE_PERROR("cache_set: victim alloc failed");
return;
}
newbuf = malloc(su->su_iosz);
if (newbuf == NULL) {
- CACHE_PERROR("cache_set: could not allocate new rpc_buffer");
free(victim);
return;
}