[telepathy-glib/master] debug.c: don't rely on STDOUT_FILENO, STDERR_FILENO

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Nov 13 06:46:48 PST 2009


Windows doesn't have these, and their numeric values seem more universal
than the actual macros (for instance, basically every shell script relies
on stdout and stderr being fd 1 and 2).
---
 telepathy-glib/debug.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/telepathy-glib/debug.c b/telepathy-glib/debug.c
index 728e5c3..c144c54 100644
--- a/telepathy-glib/debug.c
+++ b/telepathy-glib/debug.c
@@ -405,14 +405,14 @@ tp_debug_divert_messages (const gchar *filename)
       return;
     }
 
-  if (dup2 (fd, STDOUT_FILENO) == -1)
+  if (dup2 (fd, 1) == -1)     /* STDOUT_FILENO is less universal */
     {
       g_warning ("Error duplicating stdout file descriptor: %s",
           g_strerror (errno));
       return;
     }
 
-  if (dup2 (fd, STDERR_FILENO) == -1)
+  if (dup2 (fd, 2) == -1)     /* STDERR_FILENO is less universal */
     {
       g_warning ("Error duplicating stderr file descriptor: %s",
           g_strerror (errno));
-- 
1.5.6.5



More information about the telepathy-commits mailing list