summaryrefslogtreecommitdiff
path: root/sunrpc/svc_udp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-17 04:49:12 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-17 04:49:12 +0000
commit51028f34ceeb7c4c91abc2ac2b818afeaa671b91 (patch)
tree165d143b47736e6438b31cfb98d80fdc11cdcbb5 /sunrpc/svc_udp.c
parentd79e55530924e8fc9b33991ab4df33653480ec0a (diff)
Update.
* libio/tst-ungetwc2.c (main): Define str const. * include/wchar.h: Add prototypes for __fwprintf and __vfwprintf. * libio/fwprintf.c: Also define __fwprintf. * stdio-common/vfprintf.c [COMPILE_WPRINTF]: Also define __vfwprintf. * argp/argp-fmtstream.c: Handle wide oriented stderr stream. * assert/assert-perr.c: Likewise. * assert/assert.c: Likewise. * gmon/gmon.c: Likewise. * inet/rcmd.c: Likewise. * malloc/obstack.c: Likewise. * misc/err.c: Likewise. * misc/error.c: Likewise. * misc/getpass.c: Likewise. * posix/getopt.c: Likewise. * resolv/res_hconf.c: Likewise. * stdio-common/perror.c: Likewise. * stdio-common/psignal.c: Likewise. * stdlib/fmtmsg.c: Likewise. * sunrpc/auth_unix.c: Likewise. * sunrpc/clnt_perr.c: Likewise. * sunrpc/clnt_tcp.c: Likewise. * sunrpc/clnt_udp.c: Likewise. * sunrpc/clnt_unix.c: Likewise. * sunrpc/svc_simple.c: Likewise. * sunrpc/svc_tcp.c: Likewise. * sunrpc/svc_udp.c: Likewise. * sunrpc/svc_unix.c: Likewise. * sunrpc/xdr.c: Likewise. * sunrpc/xdr_array.c: Likewise. * sunrpc/xdr_rec.c: Likewise. * sunrpc/xdr_ref.c: Likewise. * sysdeps/generic/wordexp.c: Likewise. * misc/err.c: Handle wide oriented stderr stream.
Diffstat (limited to 'sunrpc/svc_udp.c')
-rw-r--r--sunrpc/svc_udp.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index f912260ef5..f8ea76c0b8 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -52,6 +52,7 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
#endif
#ifdef USE_IN_LIBIO
+# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
@@ -118,7 +119,8 @@ svcudp_bufcreate (sock, sendsz, recvsz)
struct svcudp_data *su;
struct sockaddr_in addr;
socklen_t len = sizeof (struct sockaddr_in);
- int pad;
+ int pad;
+ void *buf;
if (sock == RPC_ANYSOCK)
{
@@ -144,23 +146,20 @@ svcudp_bufcreate (sock, sendsz, recvsz)
return (SVCXPRT *) NULL;
}
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
- if (xprt == NULL)
- {
- (void) fputs (_("svcudp_create: out of memory\n"), stderr);
- return NULL;
- }
su = (struct svcudp_data *) mem_alloc (sizeof (*su));
- if (su == NULL)
+ buf = mem_alloc (((MAX (sendsz, recvsz) + 3) / 4) * 4);
+ if (xprt == NULL || su == NULL || buf == NULL)
{
- (void) fputs (_("svcudp_create: out of memory\n"), stderr);
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n"));
+ else
+#endif
+ (void) fputs (_("svcudp_create: out of memory\n"), stderr);
return NULL;
}
su->su_iosz = ((MAX (sendsz, recvsz) + 3) / 4) * 4;
- if ((rpc_buffer (xprt) = mem_alloc (su->su_iosz)) == NULL)
- {
- (void) fputs (_("svcudp_create: out of memory\n"), stderr);
- return NULL;
- }
+ rpc_buffer (xprt) = buf;
xdrmem_create (&(su->su_xdrs), rpc_buffer (xprt), su->su_iosz, XDR_DECODE);
su->su_cache = NULL;
xprt->xp_p2 = (caddr_t) su;
@@ -174,8 +173,14 @@ svcudp_bufcreate (sock, sendsz, recvsz)
+ sizeof(struct cmsghdr) + sizeof (struct in_pktinfo))
> sizeof (xprt->xp_pad))
{
- (void) fputs (_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"),
- stderr);
+# ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s",
+ _("svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
+ else
+# endif
+ (void) fputs (_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"),
+ stderr);
return NULL;
}
pad = 1;
@@ -380,8 +385,16 @@ svcudp_destroy (xprt)
#define SPARSENESS 4 /* 75% sparse */
-#define CACHE_PERROR(msg) \
+#ifdef USE_IN_LIBIO
+# define CACHE_PERROR(msg) \
+ if (_IO_fwide (stderr, 0) > 0) \
+ (void) __fwprintf(stderr, L"%s\n", msg); \
+ else \
+ (void) fprintf(stderr, "%s\n", msg)
+#else
+# define CACHE_PERROR(msg) \
(void) fprintf(stderr,"%s\n", msg)
+#endif
#define ALLOC(type, size) \
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))