]> granicus.if.org Git - procps-ng/commitdiff
skill: check return value of getline
authorMike Frysinger <vapier@gentoo.org>
Sun, 20 May 2012 10:22:01 +0000 (06:22 -0400)
committerCraig Small <csmall@enc.com.au>
Tue, 22 May 2012 10:19:03 +0000 (20:19 +1000)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
skill.c

diff --git a/skill.c b/skill.c
index 791cfa05fd990fa1eeb79a40c9229c378cfbfbd9..94bf9c93ae0969bd88e07b4c4678be48ff463248 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -98,7 +98,8 @@ static void hurt_proc(int tty, int uid, int pid, const char *restrict const cmd,
                fprintf(stderr, "%-8s %-8s %5d %-16.16s   ? ",
                        (char *)dn_buf, user_from_uid(uid), pid, cmd);
                fflush (stdout);
-               getline(&buf, &len, stdin);
+               if (getline(&buf, &len, stdin) == -1)
+                       return;
                if (rpmatch(buf) < 1) {
                        free(buf);
                        return;