about summary refs log tree commit diff
path: root/sunrpc/svc_simple.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-01 22:18:24 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-01 22:18:24 +0000
commit322861e8b62dbca030a66f9ab37e6688b223c65f (patch)
tree4ee930f44d4484f577cae54b3845e91ae6517d57 /sunrpc/svc_simple.c
parent9ddfc0595a4444ee13aec46e118b3b3463012267 (diff)
downloadglibc-322861e8b62dbca030a66f9ab37e6688b223c65f.tar.gz
glibc-322861e8b62dbca030a66f9ab37e6688b223c65f.tar.xz
glibc-322861e8b62dbca030a66f9ab37e6688b223c65f.zip
Update.
2004-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	* argp/argp-help.c (__argp_error, __argp_failure): Check result
	of __asprintf call and don't use string if it failed.
	* stdio-common/psignal.c (psignal): Likewise.
	* locale/programs/localedef.c (more_help): Likewise.
	* resolv/res_hconf.c (arg_service_list, arg_trimdomain_list,
	arg_bool, parse_line): Check result of __asprintf calls and
	don't use string if they failed.
	* sunrpc/svc_simple.c (registerrpc, universal): Likewise.
	* elf/ldconfig.c (parse_conf_include): Check result of __asprintf
	call and exit if it failed.
Diffstat (limited to 'sunrpc/svc_simple.c')
-rw-r--r--sunrpc/svc_simple.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/sunrpc/svc_simple.c b/sunrpc/svc_simple.c
index 57bedba163..5ac21ffdbd 100644
--- a/sunrpc/svc_simple.c
+++ b/sunrpc/svc_simple.c
@@ -84,8 +84,9 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum,
   if (procnum == NULLPROC)
     {
 
-      (void) __asprintf (&buf, _("can't reassign procedure number %ld\n"),
-			 NULLPROC);
+      if (__asprintf (&buf, _("can't reassign procedure number %ld\n"),
+		      NULLPROC) < 0)
+	buf = NULL;
       goto err_out;
     }
   if (transp == 0)
@@ -101,8 +102,9 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum,
   if (!svc_register (transp, (u_long) prognum, (u_long) versnum,
 		     universal, IPPROTO_UDP))
     {
-      (void) __asprintf (&buf, _("couldn't register prog %ld vers %ld\n"),
-			 prognum, versnum);
+      if (__asprintf (&buf, _("couldn't register prog %ld vers %ld\n"),
+		      prognum, versnum) < 0)
+	buf = NULL;
       goto err_out;
     }
   pl = (struct proglst_ *) malloc (sizeof (struct proglst_));
@@ -121,6 +123,8 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum,
   return 0;
 
  err_out:
+  if (buf == NULL)
+    return -1;
 #ifdef USE_IN_LIBIO
   if (_IO_fwide (stderr, 0) > 0)
     (void) __fwprintf (stderr, L"%s", buf);
@@ -171,16 +175,20 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l)
 	  return;
 	if (!INTUSE(svc_sendreply) (transp_l, pl->p_outproc, outdata))
 	  {
-	    (void) __asprintf (&buf,
-			       _("trouble replying to prog %d\n"),
-			       pl->p_prognum);
-	    exit (1);
+	    if (__asprintf (&buf, _("trouble replying to prog %d\n"),
+			    pl->p_prognum) < 0)
+	      buf = NULL;
+	    goto err_out2;
 	  }
 	/* free the decoded arguments */
 	(void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf);
 	return;
       }
-  (void) __asprintf (&buf, _("never registered prog %d\n"), prog);
+  if (__asprintf (&buf, _("never registered prog %d\n"), prog) < 0)
+    buf = NULL;
+ err_out2:
+  if (buf == NULL)
+    exit (1);
 #ifdef USE_IN_LIBIO
   if (_IO_fwide (stderr, 0) > 0)
     __fwprintf (stderr, L"%s", buf);