don't print errno twice

when passing the M_ERRNO flag to msg(), the latter will already
print the errno message (in a form of a string and number) for us,
hence there is no need to explicitly print it a second time.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20170713080527.13299-2-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15057.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Antonio Quartulli 2017-07-13 16:05:27 +08:00 committed by Gert Doering
parent 56b396dcbc
commit e441d86188
2 changed files with 6 additions and 8 deletions

View File

@ -159,7 +159,7 @@ platform_nice(int niceval)
errno = 0;
if (nice(niceval) < 0 && errno != 0)
{
msg(M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
msg(M_WARN | M_ERRNO, "WARNING: nice %d failed", niceval);
}
else
{

View File

@ -2563,8 +2563,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
if (ioctl(tt->fd, TUNGIFINFO, &info) < 0)
{
msg(M_WARN | M_ERRNO, "Can't get interface info: %s",
strerror(errno));
msg(M_WARN | M_ERRNO, "Can't get interface info");
}
#ifdef IFF_MULTICAST /* openbsd 4.x doesn't have this */
@ -2573,8 +2572,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
if (ioctl(tt->fd, TUNSIFINFO, &info) < 0)
{
msg(M_WARN | M_ERRNO, "Can't set interface info: %s",
strerror(errno));
msg(M_WARN | M_ERRNO, "Can't set interface info");
}
}
}
@ -2663,7 +2661,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
i = 1;
if (ioctl(tt->fd, TUNSIFHEAD, &i) < 0) /* multi-af mode on */
{
msg(M_WARN | M_ERRNO, "ioctl(TUNSIFHEAD): %s", strerror(errno));
msg(M_WARN | M_ERRNO, "ioctl(TUNSIFHEAD)");
}
}
}
@ -2796,12 +2794,12 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
if (ioctl(tt->fd, TUNSIFMODE, &i) < 0)
{
msg(M_WARN | M_ERRNO, "ioctl(TUNSIFMODE): %s", strerror(errno));
msg(M_WARN | M_ERRNO, "ioctl(TUNSIFMODE)");
}
i = 1;
if (ioctl(tt->fd, TUNSIFHEAD, &i) < 0)
{
msg(M_WARN | M_ERRNO, "ioctl(TUNSIFHEAD): %s", strerror(errno));
msg(M_WARN | M_ERRNO, "ioctl(TUNSIFHEAD)");
}
}
}