diff --git a/src/inet.c b/src/inet.c
index aa94975..1e9b959 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -2,7 +2,7 @@
* ProFTPD - FTP server daemon
* Copyright (c) 1997, 1998 Public Flood Software
* Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net>
- * Copyright (c) 2001-2013 The ProFTPD Project team
+ * Copyright (c) 2001-2014 The ProFTPD Project team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -771,8 +771,15 @@ int pr_inet_set_proto_opts(pool *p, conn_t *c, int mss, int nodelay,
/* Only set TCLASS flags on IPv6 sockets; IPv4 sockets use TOS. */
if (pr_netaddr_get_family(c->local_addr) == AF_INET6) {
if (c->listen_fd != -1) {
- if (setsockopt(c->listen_fd, ip_level, IPV6_TCLASS, (void *) &tos,
- sizeof(tos)) < 0) {
+ int res;
+
+ res = setsockopt(c->listen_fd, ip_level, IPV6_TCLASS, (void *) &tos,
+ sizeof(tos));
+ if (res < 0
+#ifdef ENOPROTOOPT
+ && errno != ENOPROTOOPT
+#endif /* !ENOPROTOOPT */
+ ) {
pr_log_pri(PR_LOG_NOTICE, "error setting listen fd IPV6_TCLASS: %s",
strerror(errno));
}