diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-08-17 04:49:12 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-08-17 04:49:12 +0000 |
commit | 51028f34ceeb7c4c91abc2ac2b818afeaa671b91 (patch) | |
tree | 165d143b47736e6438b31cfb98d80fdc11cdcbb5 /sunrpc | |
parent | d79e55530924e8fc9b33991ab4df33653480ec0a (diff) | |
download | glibc-51028f34ceeb7c4c91abc2ac2b818afeaa671b91.tar.gz |
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')
-rw-r--r-- | sunrpc/auth_unix.c | 27 | ||||
-rw-r--r-- | sunrpc/clnt_perr.c | 22 | ||||
-rw-r--r-- | sunrpc/clnt_tcp.c | 27 | ||||
-rw-r--r-- | sunrpc/clnt_udp.c | 23 | ||||
-rw-r--r-- | sunrpc/clnt_unix.c | 24 | ||||
-rw-r--r-- | sunrpc/svc_simple.c | 52 | ||||
-rw-r--r-- | sunrpc/svc_tcp.c | 37 | ||||
-rw-r--r-- | sunrpc/svc_udp.c | 45 | ||||
-rw-r--r-- | sunrpc/svc_unix.c | 40 | ||||
-rw-r--r-- | sunrpc/xdr.c | 20 | ||||
-rw-r--r-- | sunrpc/xdr_array.c | 14 | ||||
-rw-r--r-- | sunrpc/xdr_rec.c | 18 | ||||
-rw-r--r-- | sunrpc/xdr_ref.c | 9 |
13 files changed, 229 insertions, 129 deletions
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c index a03ce0219a..50f955146c 100644 --- a/sunrpc/auth_unix.c +++ b/sunrpc/auth_unix.c @@ -50,6 +50,10 @@ #include <rpc/auth.h> #include <rpc/auth_unix.h> +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif + /* * Unix authenticator operations vector */ @@ -101,15 +105,16 @@ authunix_create (char *machname, uid_t uid, gid_t gid, int len, * Allocate and set up auth handle */ auth = (AUTH *) mem_alloc (sizeof (*auth)); - if (auth == NULL) - { - (void) fprintf (stderr, _("authunix_create: out of memory\n")); - return NULL; - } au = (struct audata *) mem_alloc (sizeof (*au)); - if (au == NULL) + if (auth == NULL || au == NULL) { - (void) fprintf (stderr, _("authunix_create: out of memory\n")); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("authunix_create: out of memory\n")); + else +#endif + (void) fputs (_("authunix_create: out of memory\n"), stderr); return NULL; } auth->ah_ops = &auth_unix_ops; @@ -139,7 +144,13 @@ authunix_create (char *machname, uid_t uid, gid_t gid, int len, au->au_origcred.oa_base = mem_alloc ((u_int) len); if (au->au_origcred.oa_base == NULL) { - (void) fputs (_("authunix_create: out of memory\n"), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("authunix_create: out of memory\n")); + else +#endif + (void) fputs (_("authunix_create: out of memory\n"), stderr); return NULL; } memcpy(au->au_origcred.oa_base, mymem, (u_int) len); diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c index 55d38153b9..4164539dd2 100644 --- a/sunrpc/clnt_perr.c +++ b/sunrpc/clnt_perr.c @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro"; #include <rpc/rpc.h> #ifdef USE_IN_LIBIO +# include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) #endif @@ -154,7 +155,12 @@ clnt_sperror (CLIENT * rpch, const char *msg) void clnt_perror (CLIENT * rpch, const char *msg) { - (void) fputs (clnt_sperror (rpch, msg), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", clnt_sperror (rpch, msg)); + else +#endif + (void) fputs (clnt_sperror (rpch, msg), stderr); } @@ -281,7 +287,12 @@ clnt_sperrno (enum clnt_stat stat) void clnt_perrno (enum clnt_stat num) { - (void) fputs (clnt_sperrno (num), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", clnt_sperrno (num)); + else +#endif + (void) fputs (clnt_sperrno (num), stderr); } @@ -323,7 +334,12 @@ clnt_spcreateerror (const char *msg) void clnt_pcreateerror (const char *msg) { - (void) fputs (clnt_spcreateerror (msg), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", clnt_spcreateerror (msg)); + else +#endif + (void) fputs (clnt_spcreateerror (msg), stderr); } struct auth_errtab diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c index e3076524a7..6267dc70f6 100644 --- a/sunrpc/clnt_tcp.c +++ b/sunrpc/clnt_tcp.c @@ -59,6 +59,9 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; #include <sys/poll.h> #include <sys/socket.h> #include <rpc/pmap_clnt.h> +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif extern u_long _create_xid (void); @@ -117,25 +120,23 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp, u_int sendsz, u_int recvsz) { CLIENT *h; - struct ct_data *ct = (struct ct_data *) mem_alloc (sizeof (*ct)); + struct ct_data *ct; struct rpc_msg call_msg; h = (CLIENT *) mem_alloc (sizeof (*h)); - if (h == NULL) + ct = (struct ct_data *) mem_alloc (sizeof (*ct)); + if (h == NULL || ct == NULL) { struct rpc_createerr *ce = &get_rpc_createerr (); - (void) fprintf (stderr, _("clnttcp_create: out of memory\n")); - ce->cf_stat = RPC_SYSTEMERROR; - ce->cf_error.re_errno = errno; - goto fooy; - } - /* ct = (struct ct_data *) mem_alloc (sizeof (*ct)); */ - if (ct == NULL) - { - struct rpc_createerr *ce = &get_rpc_createerr (); - (void) fprintf (stderr, _("clnttcp_create: out of memory\n")); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("clnttcp_create: out of memory\n")); + else +#endif + (void) fputs (_("clnttcp_create: out of memory\n"), stderr); ce->cf_stat = RPC_SYSTEMERROR; - ce->cf_error.re_errno = errno; + ce->cf_error.re_errno = ENOMEM; goto fooy; } diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index bf98553b8d..94b672174f 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -50,6 +50,9 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #include <errno.h> #include <rpc/pmap_clnt.h> #include <net/if.h> +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif #ifdef IP_RECVERR #include <errqueue.h> @@ -126,23 +129,21 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, struct rpc_msg call_msg; cl = (CLIENT *) mem_alloc (sizeof (CLIENT)); - if (cl == NULL) - { - struct rpc_createerr *ce = &get_rpc_createerr (); - (void) fprintf (stderr, _("clntudp_create: out of memory\n")); - ce->cf_stat = RPC_SYSTEMERROR; - ce->cf_error.re_errno = errno; - goto fooy; - } sendsz = ((sendsz + 3) / 4) * 4; recvsz = ((recvsz + 3) / 4) * 4; cu = (struct cu_data *) mem_alloc (sizeof (*cu) + sendsz + recvsz); - if (cu == NULL) + if (cl == NULL || cu == NULL) { struct rpc_createerr *ce = &get_rpc_createerr (); - (void) fprintf (stderr, _("clntudp_create: out of memory\n")); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("clntudp_create: out of memory\n")); + else +#endif + (void) fputs (_("clntudp_create: out of memory\n"), stderr); ce->cf_stat = RPC_SYSTEMERROR; - ce->cf_error.re_errno = errno; + ce->cf_error.re_errno = ENOMEM; goto fooy; } cu->cu_outbuf = &cu->cu_inbuf[recvsz]; diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c index 19356ad032..64a97a1b68 100644 --- a/sunrpc/clnt_unix.c +++ b/sunrpc/clnt_unix.c @@ -56,6 +56,9 @@ #include <sys/poll.h> #include <sys/socket.h> #include <rpc/pmap_clnt.h> +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif extern u_long _create_xid (void); @@ -119,21 +122,18 @@ clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, int len; h = (CLIENT *) mem_alloc (sizeof (*h)); - if (h == NULL) - { - struct rpc_createerr *ce = &get_rpc_createerr (); - (void) fputs (_("clntunix_create: out of memory\n"), stderr); - ce->cf_stat = RPC_SYSTEMERROR; - ce->cf_error.re_errno = errno; - goto fooy; - } - /* ct = (struct ct_data *) mem_alloc (sizeof (*ct)); */ - if (ct == NULL) + if (h == NULL || ct == NULL) { struct rpc_createerr *ce = &get_rpc_createerr (); - (void) fputs (_("clntunix_create: out of memory\n"), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("clntunix_create: out of memory\n")); + else +#endif + (void) fputs (_("clntunix_create: out of memory\n"), stderr); ce->cf_stat = RPC_SYSTEMERROR; - ce->cf_error.re_errno = errno; + ce->cf_error.re_errno = ENOMEM; goto fooy; } diff --git a/sunrpc/svc_simple.c b/sunrpc/svc_simple.c index 979b5b69df..db77743360 100644 --- a/sunrpc/svc_simple.c +++ b/sunrpc/svc_simple.c @@ -41,12 +41,14 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro"; #include <stdio.h> #include <string.h> #include <libintl.h> +#include <unistd.h> #include <rpc/rpc.h> #include <rpc/pmap_clnt.h> #include <sys/socket.h> #include <netdb.h> #ifdef USE_IN_LIBIO +# include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) #endif @@ -78,35 +80,37 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, char *(*progname) (char *), xdrproc_t inproc, xdrproc_t outproc) { struct proglst_ *pl; + char *buf; if (procnum == NULLPROC) { - (void) fprintf (stderr, - _("can't reassign procedure number %ld\n"), NULLPROC); - return -1; + + (void) __asprintf (&buf, _("can't reassign procedure number %ld\n"), + NULLPROC); + goto err_out; } if (transp == 0) { transp = svcudp_create (RPC_ANYSOCK); if (transp == NULL) { - (void) fputs (_("couldn't create an rpc server\n"), stderr); - return -1; + buf = strdup (_("couldn't create an rpc server\n")); + goto err_out; } } (void) pmap_unset ((u_long) prognum, (u_long) versnum); if (!svc_register (transp, (u_long) prognum, (u_long) versnum, universal, IPPROTO_UDP)) { - (void) fprintf (stderr, _("couldn't register prog %ld vers %ld\n"), - prognum, versnum); - return -1; + (void) __asprintf (&buf, _("couldn't register prog %ld vers %ld\n"), + prognum, versnum); + goto err_out; } pl = (struct proglst_ *) malloc (sizeof (struct proglst_)); if (pl == NULL) { - (void) fprintf (stderr, _("registerrpc: out of memory\n")); - return -1; + buf = strdup (_("registerrpc: out of memory\n")); + goto err_out; } pl->p_progname = progname; pl->p_prognum = prognum; @@ -116,6 +120,16 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, pl->p_nxt = proglst; proglst = pl; return 0; + + err_out: +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) fwprintf (stderr, L"%s", buf); + else +#endif + (void) fputs (buf, stderr); + free (buf); + return -1; } static void @@ -125,6 +139,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) char *outdata; char xdrbuf[UDPMSGSIZE]; struct proglst_ *pl; + char *buf = NULL; /* * enforce "procnum 0 is echo" convention @@ -133,7 +148,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) { if (svc_sendreply (transp_l, (xdrproc_t)xdr_void, (char *) NULL) == FALSE) { - (void) fprintf (stderr, "xxx\n"); + write (STDERR_FILENO, "xxx\n", 4); exit (1); } return; @@ -156,15 +171,22 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) return; if (!svc_sendreply (transp_l, pl->p_outproc, outdata)) { - (void) fprintf (stderr, - _ ("trouble replying to prog %d\n"), - pl->p_prognum); + (void) __asprintf (&buf, + _("trouble replying to prog %d\n"), + pl->p_prognum); exit (1); } /* free the decoded arguments */ (void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf); return; } - (void) fprintf (stderr, _ ("never registered prog %d\n"), prog); + (void) __asprintf (&buf, _("never registered prog %d\n"), prog); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + free (buf); exit (1); } diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c index 06c05a640d..2fffdf5b5c 100644 --- a/sunrpc/svc_tcp.c +++ b/sunrpc/svc_tcp.c @@ -52,6 +52,7 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; #include <stdlib.h> #ifdef USE_IN_LIBIO +# include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) #endif @@ -173,19 +174,19 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) return (SVCXPRT *) NULL; } r = (struct tcp_rendezvous *) mem_alloc (sizeof (*r)); - if (r == NULL) + xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); + if (r == NULL || xprt == NULL) { - (void) fputs (_("svctcp_create: out of memory\n"), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", _("svctcp_create: out of memory\n")); + else +#endif + (void) fputs (_("svctcp_create: out of memory\n"), stderr); return NULL; } r->sendsize = sendsize; r->recvsize = recvsize; - xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); - if (xprt == NULL) - { - (void) fputs (_("svctcp_create: out of memory\n"), stderr); - return NULL; - } xprt->xp_p2 = NULL; xprt->xp_p1 = (caddr_t) r; xprt->xp_verf = _null_auth; @@ -214,18 +215,17 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize) struct tcp_conn *cd; xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); - if (xprt == (SVCXPRT *) NULL) - { - (void) fputs (_("svc_tcp: makefd_xprt: out of memory\n"), stderr); - goto done; - } cd = (struct tcp_conn *) mem_alloc (sizeof (struct tcp_conn)); - if (cd == (struct tcp_conn *) NULL) + if (xprt == (SVCXPRT *) NULL || cd == NULL) { - (void) fputs (_("svc_tcp: makefd_xprt: out of memory\n"), stderr); - mem_free ((char *) xprt, sizeof (SVCXPRT)); - xprt = (SVCXPRT *) NULL; - goto done; +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("svc_tcp: makefd_xprt: out of memory\n")); + else +#endif + (void) fputs (_("svc_tcp: makefd_xprt: out of memory\n"), stderr); + return NULL; } cd->strm_stat = XPRT_IDLE; xdrrec_create (&(cd->xdrs), sendsize, recvsize, @@ -238,7 +238,6 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize) xprt->xp_port = 0; /* this is a connection, not a rendezvouser */ xprt->xp_sock = fd; xprt_register (xprt); -done: return xprt; } 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))) diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c index 20bc0aaf38..99e5a2a781 100644 --- a/sunrpc/svc_unix.c +++ b/sunrpc/svc_unix.c @@ -49,6 +49,10 @@ #include <stdlib.h> #include <libintl.h> +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif + /* * Ops vector for AF_UNIX based rpc service handle */ @@ -166,19 +170,19 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path) } r = (struct unix_rendezvous *) mem_alloc (sizeof (*r)); - if (r == NULL) + xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); + if (r == NULL || xprt == NULL) { - fputs (_("svcunix_create: out of memory\n"), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", _("svcunix_create: out of memory\n")); + else +#endif + fputs (_("svcunix_create: out of memory\n"), stderr); return NULL; } r->sendsize = sendsize; r->recvsize = recvsize; - xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); - if (xprt == NULL) - { - fputs (_("svcunix_create: out of memory\n"), stderr); - return NULL; - } xprt->xp_p2 = NULL; xprt->xp_p1 = (caddr_t) r; xprt->xp_verf = _null_auth; @@ -207,18 +211,17 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize) struct unix_conn *cd; xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); - if (xprt == (SVCXPRT *) NULL) - { - (void) fputs (_("svc_unix: makefd_xprt: out of memory\n"), stderr); - goto done; - } cd = (struct unix_conn *) mem_alloc (sizeof (struct unix_conn)); - if (cd == (struct unix_conn *) NULL) + if (xprt == (SVCXPRT *) NULL || cd == (struct unix_conn *) NULL) { - (void) fputs (_("svc_unix: makefd_xprt: out of memory\n"), stderr); - mem_free ((char *) xprt, sizeof (SVCXPRT)); - xprt = (SVCXPRT *) NULL; - goto done; +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("svc_unix: makefd_xprt: out of memory\n")); + else +#endif + (void) fputs (_("svc_unix: makefd_xprt: out of memory\n"), stderr); + return NULL; } cd->strm_stat = XPRT_IDLE; xdrrec_create (&(cd->xdrs), sendsize, recvsize, @@ -231,7 +234,6 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize) xprt->xp_port = 0; /* this is a connection, not a rendezvouser */ xprt->xp_sock = fd; xprt_register (xprt); -done: return xprt; } diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c index 46dfe3b6b4..cc1aa2c2b9 100644 --- a/sunrpc/xdr.c +++ b/sunrpc/xdr.c @@ -44,10 +44,15 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; #include <stdio.h> #include <limits.h> #include <string.h> +#include <libintl.h> #include <rpc/types.h> #include <rpc/xdr.h> +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif + /* * constants specific to the xdr "protocol" */ @@ -548,7 +553,12 @@ xdr_bytes (xdrs, cpp, sizep, maxsize) } if (sp == NULL) { - (void) fprintf (stderr, "xdr_bytes: out of memory\n"); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", _("xdr_bytes: out of memory\n")); + else +#endif + (void) fputs (_("xdr_bytes: out of memory\n"), stderr); return FALSE; } /* fall into ... */ @@ -694,7 +704,13 @@ xdr_string (xdrs, cpp, maxsize) *cpp = sp = (char *) mem_alloc (nodesize); if (sp == NULL) { - (void) fprintf (stderr, "xdr_string: out of memory\n"); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("xdr_string: out of memory\n")); + else +#endif + (void) fputs (_("xdr_string: out of memory\n"), stderr); return FALSE; } sp[size] = 0; diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c index a049b2d27d..2dbf8c1e8c 100644 --- a/sunrpc/xdr_array.c +++ b/sunrpc/xdr_array.c @@ -44,6 +44,11 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; #include <string.h> #include <rpc/types.h> #include <rpc/xdr.h> +#include <libintl.h> + +#ifdef USE_IN_LIBIO +# include <wchar.h> +#endif #define LASTUNSIGNED ((u_int)0-1) @@ -95,8 +100,13 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) *addrp = target = mem_alloc (nodesize); if (target == NULL) { - (void) fprintf (stderr, - "xdr_array: out of memory\n"); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("xdr_array: out of memory\n")); + else +#endif + (void) fputs (_("xdr_array: out of memory\n"), stderr); return FALSE; } __bzero (target, nodesize); diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c index 3544edc2e8..17c9b35575 100644 --- a/sunrpc/xdr_rec.c +++ b/sunrpc/xdr_rec.c @@ -51,6 +51,7 @@ #include <libintl.h> #ifdef USE_IN_LIBIO +# include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) #endif @@ -145,10 +146,16 @@ xdrrec_create (XDR *xdrs, u_int sendsize, { RECSTREAM *rstrm = (RECSTREAM *) mem_alloc (sizeof (RECSTREAM)); caddr_t tmp; + char *buf = mem_alloc (sendsize + recvsize + BYTES_PER_XDR_UNIT); - if (rstrm == NULL) + if (rstrm == NULL || buf == NULL) { - (void) fputs (_("xdrrec_create: out of memory\n"), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", _("xdrrec_create: out of memory\n")); + else +#endif + (void) fputs (_("xdrrec_create: out of memory\n"), stderr); /* * This is bad. Should rework xdrrec_create to * return a handle, and in this case return NULL @@ -160,12 +167,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize, */ rstrm->sendsize = sendsize = fix_buf_size (sendsize); rstrm->recvsize = recvsize = fix_buf_size (recvsize); - rstrm->the_buffer = mem_alloc (sendsize + recvsize + BYTES_PER_XDR_UNIT); - if (rstrm->the_buffer == NULL) - { - (void) fputs (_("xdrrec_create: out of memory\n"), stderr); - return; - } + rstrm->the_buffer = buf; tmp = rstrm->the_buffer; if ((size_t)tmp % BYTES_PER_XDR_UNIT) tmp += BYTES_PER_XDR_UNIT - (size_t)tmp % BYTES_PER_XDR_UNIT; diff --git a/sunrpc/xdr_ref.c b/sunrpc/xdr_ref.c index 2a9ffb1696..e49329f20e 100644 --- a/sunrpc/xdr_ref.c +++ b/sunrpc/xdr_ref.c @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; #include <libintl.h> #ifdef USE_IN_LIBIO +# include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) #endif @@ -82,7 +83,13 @@ xdr_reference (xdrs, pp, size, proc) *pp = loc = (caddr_t) mem_alloc (size); if (loc == NULL) { - (void) fputs (_("xdr_reference: out of memory\n"), stderr); +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + (void) __fwprintf (stderr, L"%s", + _("xdr_reference: out of memory\n")); + else +#endif + (void) fputs (_("xdr_reference: out of memory\n"), stderr); return FALSE; } __bzero (loc, (int) size); |