]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
su: (pty) fix slave terminal attributes initialization
authorKarel Zak <kzak@redhat.com>
Thu, 7 Sep 2017 08:45:24 +0000 (10:45 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Sep 2017 09:49:11 +0000 (11:49 +0200)
Reported-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/su-common.c

index bfccb4643e446537d17b06a836848ff616eed57c..f873c23bcb8931d2f744697abbf51077fc14c9fd 100644 (file)
@@ -273,7 +273,7 @@ static void pty_create(struct su_context *su)
                rc = openpty(&su->pty_master, &su->pty_slave, NULL, NULL, NULL);
 
                /* set slave attributes */
-               if (rc < 0) {
+               if (!rc) {
                        tcgetattr(su->pty_slave, &slave_attrs);
                        cfmakeraw(&slave_attrs);
                        tcsetattr(su->pty_slave, TCSANOW, &slave_attrs);