summaryrefslogtreecommitdiff
path: root/include/share
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-01-19 18:16:26 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2016-01-19 18:20:25 +1100
commit293d6b22cd09b8d9c376d447a933641da9828036 (patch)
tree9cf3057dc5054100ba7520ff4ceaf77b371c5f05 /include/share
parentcc55e651822a24ed58e3a8eed0be9e7c4cda598f (diff)
downloadflac-293d6b22cd09b8d9c376d447a933641da9828036.tar.gz
macros.h: Make FLAC_CHECK_RETURN print to stderr
Also comment the fact that this macro should only be used for things that are extremely unlikely to fail.
Diffstat (limited to 'include/share')
-rw-r--r--include/share/macros.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/share/macros.h b/include/share/macros.h
index 5b9cf4e1..eea62c10 100644
--- a/include/share/macros.h
+++ b/include/share/macros.h
@@ -32,10 +32,14 @@
#include <errno.h>
/* FLAC_CHECK_RETURN : Check the return value of the provided function and
- * print and error message if it fails (ie returns a value < 0).
+ * print an error message if it fails (ie returns a value < 0).
+ *
+ * Ideally, a library should not print anything, but this macro is only used
+ * for things that extremely unlikely to fail, like `chown` to a previoulsy
+ * saved `uid`.
*/
#define FLAC_CHECK_RETURN(x) \
{ if ((x) < 0) \
- printf ("%s : %s\n", #x, strerror (errno)) ; \
+ fprintf (stderr, "%s : %s\n", #x, strerror (errno)) ; \
}