# HG changeset patch # User Matti Hamalainen # Date 1401164834 -10800 # Node ID 29b8ff5b625bef35cbf60ecb9165fb20665cd970 # Parent a1abf812785fba14907135852d24825d6f63782e Use th_get_error() and th_error_str(). diff -r a1abf812785f -r 29b8ff5b625b main.c --- 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 #include #include #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; }