8f2528
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c
8f2528
index 22ea8ef..2660085 100644
8f2528
--- a/openbsd-compat/port-linux.c
8f2528
+++ b/openbsd-compat/port-linux.c
8f2528
@@ -116,7 +116,11 @@ ssh_selinux_setup_pty(char *pwname, const char *tty)
8f2528
 
8f2528
 	debug3("%s: setting TTY context on %s", __func__, tty);
8f2528
 
8f2528
-	user_ctx = ssh_selinux_getctxbyname(pwname);
8f2528
+	if (getexeccon(&user_ctx) != 0) {
8f2528
+		error("%s: getexeccon: %s", __func__, strerror(errno));
8f2528
+		goto out;
8f2528
+	}
8f2528
+
8f2528
 
8f2528
 	/* XXX: should these calls fatal() upon failure in enforcing mode? */
8f2528