--- src/sleep.c.old	2010-01-01 13:06:47.000000000 +0000
+++ src/sleep.c	2010-04-27 04:21:38.000000000 +0000
@@ -17,6 +17,7 @@
 
 #include <config.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/types.h>
 #include <getopt.h>
 
@@ -28,6 +29,9 @@
 #include "xnanosleep.h"
 #include "xstrtod.h"
 
+static char fmtstring[10];
+static char buf[100];
+
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "sleep"
 
@@ -58,7 +62,16 @@
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
       emit_ancillary_info ();
     }
-  exit (status);
+  int count = -1;
+  /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)
+     support %n in format strings in read-only memory but not in writable
+     memory.  */
+  strcpy (fmtstring, "%d %n");
+  if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0
+      || strcmp (buf, "123 ") != 0
+      || count != 4)
+    exit(1);
+  exit(0);
 }
 
 /* Given a floating point value *X, and a suffix character, SUFFIX_CHAR,
