[procps] [PATCH] skill: check return value of getline

  • From: Mike Frysinger <vapier@xxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Sun, 20 May 2012 06:22:01 -0400

Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
---
 skill.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/skill.c b/skill.c
index 791cfa0..94bf9c9 100644
--- 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;
-- 
1.7.8.6


Other related posts: