changeset 621:29b8ff5b625b

Use th_get_error() and th_error_str().
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 27 May 2014 07:27:14 +0300
parents a1abf812785f
children bb6b07b44800
files main.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Tue May 27 07:25:59 2014 +0300
+++ b/main.c	Tue May 27 07:27:14 2014 +0300
@@ -8,7 +8,6 @@
 #include "ui.h"
 #include "th_args.h"
 #include "th_config.h"
-#include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
 #ifdef __WIN32
@@ -879,8 +878,9 @@
 
     if (pipe(fds) == -1)
     {
-        int ret = errno;
-        printMsgQ(currWin, "Could not open process communication pipe! (%d, %s)\n", ret, strerror(ret));
+        int ret = th_get_error();
+        printMsgQ(currWin, "Could not open process communication pipe! (%d, %s)\n",
+            ret, th_error_str(ret));
         return 0;
     }
 
@@ -895,7 +895,7 @@
         char *url = th_strdup_printf("openurl(%s,new-tab)", uri);
         execlp(setBrowser, setBrowser, "-remote", url, (void *)NULL);
         th_free(url);
-        _exit(errno);
+        _exit(th_get_error());
     }
 
     wait(&status);
@@ -1202,8 +1202,9 @@
         (ctx.fp = fdopen(cfgfd, "w")) == NULL)
 #endif
     {
+        int err = th_get_error();
         printMsgQ(currWin, "Could not create configuration to file '%s', %d: %s\n",
-            setConfigFile, errno, strerror(errno));
+            setConfigFile, err, th_error_str(err));
         goto error;
     }
 
@@ -1812,8 +1813,9 @@
         (win->logFile = fdopen(logFd, "a")) == NULL)
 #endif
     {
+        int err = th_get_error();
         errorMsg("Could not open logfile '%s' for appending, %d: %s\n",
-            win->logFilename, errno, strerror(errno));
+            win->logFilename, err, th_error_str(err));
         goto error;
     }