about summary refs log tree commit diff
path: root/elf/dl-misc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-06 00:19:11 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-06 00:19:11 +0000
commit37d8b77856be9eb9581c3c61d3f7193b3aec6b5c (patch)
tree4dc0065a6aa5f9d46947d27db2b9c83162bf4279 /elf/dl-misc.c
parentf2b98f97ebc32b68271505131b745289f3255984 (diff)
downloadglibc-37d8b77856be9eb9581c3c61d3f7193b3aec6b5c.tar.gz
glibc-37d8b77856be9eb9581c3c61d3f7193b3aec6b5c.tar.xz
glibc-37d8b77856be9eb9581c3c61d3f7193b3aec6b5c.zip
Update.
	* elf/rtld.c (process_dl_debug): Correct printing help message.
	* elf/dl-misc.c (_dl_debug_vdprintf): Implement precision handling
	for %s.
Diffstat (limited to 'elf/dl-misc.c')
-rw-r--r--elf/dl-misc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/elf/dl-misc.c b/elf/dl-misc.c
index ab883acb3c..364940b23f 100644
--- a/elf/dl-misc.c
+++ b/elf/dl-misc.c
@@ -135,6 +135,7 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
 	  /* It is a format specifier.  */
 	  char fill = ' ';
 	  int width = -1;
+	  int prec = -1;
 #if LONG_MAX != INT_MAX
 	  int long_mod = 0;
 #endif
@@ -154,6 +155,13 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
 	      ++fmt;
 	    }
 
+	  /* Handle precision.  */
+	  if (*fmt == '.' && fmt[1] == '*')
+	    {
+	      prec = va_arg (arg, int);
+	      fmt += 2;
+	    }
+
 	  /* Recognize the l modifier.  It is only important on some
 	     platforms where long and int have a different size.  We
 	     can use the same code for size_t.  */
@@ -202,6 +210,8 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
 	      /* Get the string argument.  */
 	      iov[niov].iov_base = va_arg (arg, char *);
 	      iov[niov].iov_len = strlen (iov[niov].iov_base);
+	      if (prec != -1)
+		iov[niov].iov_len = MIN (prec, iov[niov].iov_len );
 	      ++niov;
 	      break;