X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=e288902032a743cb160611d6ff7909d464bc559d;hb=e8c13ebe8001a7870a70b698d8b8fa80b7c90fd3;hp=bef3039a8ad1c7d8b67e326ee3b071dd42f19f1f;hpb=5c93f399c564f3475ffa4d3b3314a06db533e410;p=st.git diff --git a/st.c b/st.c index bef3039..e288902 100644 --- a/st.c +++ b/st.c @@ -247,7 +247,7 @@ ttynew(void) { if((m = posix_openpt(O_RDWR | O_NOCTTY)) < 0) die("openpt failed: %s\n", SERRNO); if(grantpt(m) < 0) - die("grandpt failed: %s\n", SERRNO); + die("grantpt failed: %s\n", SERRNO); if(unlockpt(m) < 0) die("unlockpt failed: %s\n", SERRNO); if(!(pts = ptsname(m))) @@ -265,7 +265,9 @@ ttynew(void) { dup2(s, STDOUT_FILENO); dup2(s, STDERR_FILENO); if(ioctl(s, TIOCSCTTY, NULL) < 0) - die("ioctl TTIOCSTTY failed: %s\n", SERRNO); + die("ioctl TIOCSCTTY failed: %s\n", SERRNO); + close(s); + close(m); execsh(); break; default: