]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - term-utils/mesg.c
su: change error message
[thirdparty/util-linux.git] / term-utils / mesg.c
index 8714ad1aa38c400943c95c3dbe76be3a0746b682..608f3cf61ace1133f93fab3c6daca5ce9cd62ec8 100644 (file)
@@ -121,6 +121,11 @@ int main(int argc, char *argv[])
        argc -= optind;
        argv += optind;
 
+       if (!isatty(STDERR_FILENO)) {
+               if (verbose)
+                       warnx(_("no tty"));
+               exit(MESG_EXIT_FAILURE);
+       }
        if ((tty = ttyname(STDERR_FILENO)) == NULL)
                err(MESG_EXIT_FAILURE, _("ttyname failed"));
        if ((fd = open(tty, O_RDONLY)) < 0)