#if UNIX_SOCK_SUPPORT
if (man->settings.flags & MF_UNIX_SOCK)
{
- msg(D_LINK_ERRORS,
- "MANAGEMENT: connect to unix socket %s failed: %s",
- sockaddr_unix_name(&man->settings.local_unix, "NULL"),
- strerror_ts(status, &gc));
+ msg(D_LINK_ERRORS | M_ERRNO,
+ "MANAGEMENT: connect to unix socket %s failed",
+ sockaddr_unix_name(&man->settings.local_unix, "NULL"));
}
else
#endif
- msg(D_LINK_ERRORS,
- "MANAGEMENT: connect to %s failed: %s",
- print_sockaddr(man->settings.local->ai_addr, &gc),
- strerror_ts(status, &gc));
+ msg(D_LINK_ERRORS | M_ERRNO,
+ "MANAGEMENT: connect to %s failed",
+ print_sockaddr(man->settings.local->ai_addr, &gc));
throw_signal_soft(SIGTERM, "management-connect-failed");
goto done;
}
else if (fd == -1 && errno != EEXIST)
{
/* Something else went wrong, no need to retry. */
- struct gc_arena gcerr = gc_new();
- msg(M_FATAL, "Could not create temporary file '%s': %s",
- retfname, strerror_ts(errno, &gcerr));
- gc_free(&gcerr);
+ msg(M_FATAL | M_ERRNO, "Could not create temporary file '%s'",
+ retfname);
return NULL;
}
}
multi.top.c2.inotify_fd = inotify_init();
if (multi.top.c2.inotify_fd < 0)
{
- msg(D_MULTI_ERRORS, "MULTI: inotify_init error: %s", strerror(errno));
+ msg(D_MULTI_ERRORS | M_ERRNO, "MULTI: inotify_init error");
}
#endif
multi.top.c2.inotify_fd = inotify_init();
if (multi.top.c2.inotify_fd < 0)
{
- msg(D_MULTI_ERRORS, "MULTI: inotify_init error: %s", strerror(errno));
+ msg(D_MULTI_ERRORS | M_ERRNO, "MULTI: inotify_init error");
}
#endif
}
else
{
- msg(M_NONFATAL, "MULTI: inotify_add_watch error: %s", strerror(errno));
+ msg(M_NONFATAL | M_ERRNO, "MULTI: inotify_add_watch error");
}
}
#endif
/* Scream if an error is found */
if (errcode > 0)
{
- msg(M_NOPREFIX|M_OPTERR, "%s fails with '%s': %s",
- opt, file, strerror(errno));
+ msg(M_NOPREFIX | M_OPTERR | M_ERRNO, "%s fails with '%s'", opt, file);
}
/* Return true if an error occured */
}
if (bind(sd, cur->ai_addr, cur->ai_addrlen))
{
- const int errnum = openvpn_errno();
- msg(M_FATAL, "%s: Socket bind failed on local address %s: %s",
+ msg(M_FATAL | M_ERRNO, "%s: Socket bind failed on local address %s",
prefix,
- print_sockaddr_ex(local->ai_addr, ":", PS_SHOW_PORT, &gc),
- strerror_ts(errnum, &gc));
+ print_sockaddr_ex(local->ai_addr, ":", PS_SHOW_PORT, &gc));
}
gc_free(&gc);
}
if (bind(sd, (struct sockaddr *) local, sizeof(struct sockaddr_un)))
{
- const int errnum = openvpn_errno();
- msg(M_FATAL, "%s: Socket bind[%d] failed on unix domain socket %s: %s",
+ msg(M_FATAL | M_ERRNO,
+ "%s: Socket bind[%d] failed on unix domain socket %s",
prefix,
(int)sd,
- sockaddr_unix_name(local, "NULL"),
- strerror_ts(errnum, &gc));
+ sockaddr_unix_name(local, "NULL"));
}
#ifdef HAVE_UMASK
const off_t off = lseek(so->fd, (off_t)0, SEEK_CUR);
if (ftruncate(so->fd, off) != 0)
{
- msg(M_WARN, "Failed to truncate status file: %s", strerror(errno));
+ msg(M_WARN | M_ERRNO, "Failed to truncate status file");
}
}
#elif defined(HAVE_CHSIZE)
if (fd < 0)
{
- msg(M_INFO, "Opening utun (%s): %s", "socket(SYSPROTO_CONTROL)",
- strerror(errno));
+ msg(M_INFO | M_ERRNO, "Opening utun (socket(SYSPROTO_CONTROL))");
return -2;
}
if (ioctl(fd, CTLIOCGINFO, &ctlInfo) == -1)
{
close(fd);
- msg(M_INFO, "Opening utun (%s): %s", "ioctl(CTLIOCGINFO)",
- strerror(errno));
+ msg(M_INFO | M_ERRNO, "Opening utun (ioctl(CTLIOCGINFO))");
return -2;
}
if (connect(fd, (struct sockaddr *)&sc, sizeof(sc)) < 0)
{
- msg(M_INFO, "Opening utun (%s): %s", "connect(AF_SYS_CONTROL)",
- strerror(errno));
+ msg(M_INFO | M_ERRNO, "Opening utun (connect(AF_SYS_CONTROL))");
close(fd);
return -1;
}