Using warn("foo %s", strerror(errno)); does not make sense because it
produces error messages
twice.
>From "man warn":
The err(), verr(), warn(), and vwarn() functions append an error
message obtained from strerror(3) based on a code or the
global variable errno, preceded by another colon and space unless the
fmt argument is NULL.
---
awesome-client.c | 6 +++---
common/socket.c | 2 +-
draw.c | 4 ++--
luaa.c | 18 +++++++++---------
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/awesome-client.c b/awesome-client.c
index c55f0d7..f1ff546 100644
--- a/awesome-client.c
+++ b/awesome-client.c
@@ -109,7 +109,7 @@ send_msg(const char *msg, ssize_t msg_len)
sockets_reconnect();
return send_msg(msg, msg_len);
default:
- warn("error sending packet: %s", strerror(errno));
+ warn("error sending packet");
}
return errno;
}
@@ -133,7 +133,7 @@ recv_msg(void)
if (r < 0)
{
if(errno != EAGAIN)
- return warn("error recieving from UNIX domain socket: %s", strerror(errno));
+ return warn("error recieving from UNIX domain socket");
try--;
}
else
@@ -191,7 +191,7 @@ main(int argc, char **argv)
if (!sockets_init())
{
- warn("can't connect to UNIX domain socket: %s", strerror(errno));
+ warn("can't connect to UNIX domain socket");
return EXIT_FAILURE;
}
diff --git a/common/socket.c b/common/socket.c
index ba89831..3843744 100644
--- a/common/socket.c
+++ b/common/socket.c
@@ -85,7 +85,7 @@ socket_getclient(void)
#endif
if(csfd < 0)
- warn("error opening UNIX domain socket: %s", strerror(errno));
+ warn("error opening UNIX domain socket");
return csfd;
}
diff --git a/draw.c b/draw.c
index 6b07644..8cb5a47 100644
--- a/draw.c
+++ b/draw.c
@@ -64,7 +64,7 @@ draw_iso2utf8(const char *iso, size_t len, char **dest, ssize_t *dlen)
warn("unable to convert text from %s to UTF-8, not available",
nl_langinfo(CODESET));
else
- warn("unable to convert text: %s", strerror(errno));
+ warn("unable to convert text");
return false;
}
@@ -78,7 +78,7 @@ draw_iso2utf8(const char *iso, size_t len, char **dest, ssize_t *dlen)
if(iconv(iso2utf8, (char **) &iso, &len, &utf8, &utf8len) == (size_t) -1)
{
- warn("text conversion failed: %s", strerror(errno));
+ warn("text conversion failed");
p_delete(dest);
}
diff --git a/luaa.c b/luaa.c
index 6e6a379..802c468 100644
--- a/luaa.c
+++ b/luaa.c
@@ -671,7 +671,7 @@ luaA_spawn(lua_State *L)
xcb_disconnect(globalconf.connection);
setsid();
a_exec(cmd);
- warn("execl '%s' failed: %s\n", cmd, strerror(errno));
+ warn("execl '%s' failed", cmd);
}
exit(EXIT_SUCCESS);
}
@@ -1086,7 +1086,7 @@ static void luaA_conn_cleanup(EV_P_ ev_io *w)
ev_ref(EV_DEFAULT_UC);
ev_io_stop(EV_DEFAULT_UC_ w);
if (close(w->fd))
- warn("error closing UNIX domain socket: %s", strerror(errno));
+ warn("error closing UNIX domain socket");
p_delete(&w);
}
@@ -1101,7 +1101,7 @@ luaA_cb(EV_P_ ev_io *w, int revents)
switch(r = recv(w->fd, buf, sizeof(buf)-1, MSG_TRUNC))
{
case -1:
- warn("error reading UNIX domain socket: %s", strerror(errno));
+ warn("error reading UNIX domain socket");
case 0: /* 0 bytes are only transferred when the connection is closed */
luaA_conn_cleanup(EV_DEFAULT_UC_ w);
break;
@@ -1131,7 +1131,7 @@ luaA_cb(EV_P_ ev_io *w, int revents)
case EAGAIN:
break;
default:
- warn("can't send back to client via domain socket: %s", strerror(errno));
+ warn("can't send back to client via domain socket");
break;
}
@@ -1167,12 +1167,12 @@ luaA_cs_init(void)
if(errno == EADDRINUSE)
{
if(unlink(addr->sun_path))
- warn("error unlinking existing file: %s", strerror(errno));
+ warn("error unlinking existing file");
if(bind(csfd, (const struct sockaddr *) addr, SUN_LEN(addr)))
- return warn("error binding UNIX domain socket: %s", strerror(errno));
+ return warn("error binding UNIX domain socket");
}
else
- return warn("error binding UNIX domain socket: %s", strerror(errno));
+ return warn("error binding UNIX domain socket");
}
listen(csfd, 10);
@@ -1189,9 +1189,9 @@ luaA_cs_cleanup(void)
ev_ref(EV_DEFAULT_UC);
ev_io_stop(EV_DEFAULT_UC_ &csio);
if (close(csio.fd))
- warn("error closing UNIX domain socket: %s", strerror(errno));
+ warn("error closing UNIX domain socket");
if(unlink(addr->sun_path))
- warn("error unlinking UNIX domain socket: %s", strerror(errno));
+ warn("error unlinking UNIX domain socket");
p_delete(&addr);
csio.fd = -1;
}