This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] test-skeleton.c: Use stderr for error messages
- From: Will Newton <will dot newton at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Fri, 11 Apr 2014 11:00:29 +0100
- Subject: [PATCH] test-skeleton.c: Use stderr for error messages
- Authentication-results: sourceware.org; auth=none
At the moment a mixture of stderr and stdout is used for error
messages. Switch to using stderr for consistency.
ChangeLog:
2014-04-09 Will Newton <will.newton@linaro.org>
* test-skeleton.c (create_temp_file): Use stderr for
outputting error messages. (main): Likewise.
---
test-skeleton.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test-skeleton.c b/test-skeleton.c
index d7d2f75..437c51d 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -110,7 +110,7 @@ create_temp_file (const char *base, char **filename)
+ sizeof ("XXXXXX"));
if (fname == NULL)
{
- puts ("out of memory");
+ fputs ("out of memory", stderr);
return -1;
}
strcpy (stpcpy (stpcpy (stpcpy (fname, test_dir), "/"), base), "XXXXXX");
@@ -118,7 +118,7 @@ create_temp_file (const char *base, char **filename)
fd = mkstemp (fname);
if (fd == -1)
{
- printf ("cannot open temporary file '%s': %m\n", fname);
+ fprintf (stderr, "cannot open temporary file '%s': %m\n", fname);
free (fname);
return -1;
}
@@ -368,12 +368,12 @@ main (int argc, char *argv[])
termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
if (termpid == -1)
{
- printf ("Waiting for test program failed: %m\n");
+ fprintf (stderr, "Waiting for test program failed: %m\n");
exit (1);
}
if (termpid != pid)
{
- printf ("Oops, wrong test program terminated: expected %ld, got %ld\n",
+ fprintf (stderr, "Oops, wrong test program terminated: expected %ld, got %ld\n",
(long int) pid, (long int) termpid);
exit (1);
}
--
1.8.1.4