about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--elf/sotruss-lib.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f87985cdb..fe612a80b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-11  Joseph Myers  <joseph@codesourcery.com>
+
+	* elf/sotruss-lib.c (init): Increase space allocated for pid by
+	one byte.  Print it with %ld, cast to long int.
+
 2017-01-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	* scripts/build-many-glibcs.py (os.cpu_count): Add compatibility definition.
diff --git a/elf/sotruss-lib.c b/elf/sotruss-lib.c
index a27ab9f6d1..da2fedd52a 100644
--- a/elf/sotruss-lib.c
+++ b/elf/sotruss-lib.c
@@ -84,11 +84,11 @@ init (void)
 
       if (out_filename != NULL && out_filename[0] != 0)
 	{
-	  size_t out_filename_len = strlen (out_filename) + 12;
+	  size_t out_filename_len = strlen (out_filename) + 13;
 	  char fullname[out_filename_len];
 	  char *endp = stpcpy (fullname, out_filename);
 	  if (which_process == NULL || which_process[0] == '\0')
-	    snprintf (endp, 12, ".%lu", (unsigned long int) pid);
+	    snprintf (endp, 13, ".%ld", (long int) pid);
 
 	  out_fd = open (fullname, O_RDWR | O_CREAT | O_TRUNC, 0666);
 	  if (out_fd != -1)