X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fpty.c;h=0f80f4863b0e1f4bde990f777bd1290331ebe91c;hb=17384d7f95169dad5f769431374fc2c08101206d;hp=52a426c0e15fd8314571570bcb94f8291cc3ae85;hpb=48fed5c55b5183e6d44702dfdccd3b5325d8689c;p=elogind.git diff --git a/src/shared/pty.c b/src/shared/pty.c index 52a426c0e..0f80f4863 100644 --- a/src/shared/pty.c +++ b/src/shared/pty.c @@ -44,18 +44,12 @@ #include #include -#include -#include #include #include #include -#include #include -#include #include -#include #include -#include #include #include #include @@ -194,13 +188,13 @@ int pty_get_fd(Pty *pty) { } int pty_make_child(Pty *pty) { - char slave_name[1024]; + _cleanup_free_ char *slave_name = NULL; int r, fd; assert_return(pty, -EINVAL); assert_return(pty_is_unknown(pty), -EALREADY); - r = ptsname_r(pty->fd, slave_name, sizeof(slave_name)); + r = ptsname_malloc(pty->fd, &slave_name); if (r < 0) return -errno; @@ -550,16 +544,15 @@ int pty_signal(Pty *pty, int sig) { } int pty_resize(Pty *pty, unsigned short term_width, unsigned short term_height) { - struct winsize ws; + struct winsize ws = { + .ws_col = term_width, + .ws_row = term_height, + }; assert_return(pty, -EINVAL); assert_return(pty_is_open(pty), -ENODEV); assert_return(pty_is_parent(pty), -ENODEV); - zero(ws); - ws.ws_col = term_width; - ws.ws_row = term_height; - /* * This will send SIGWINCH to the pty slave foreground process group. * We will also get one, but we don't need it.