summaryrefslogtreecommitdiff
path: root/data/psmisc_/getline.diff
blob: 9b2b3d44d08bad910ee586060fe10122559394ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff -r -u psmisc-22.6/src/killall.c psmisc-22.6+iPhone/src/killall.c
--- psmisc-22.6/src/killall.c	2007-06-03 10:58:09.000000000 +0000
+++ psmisc-22.6+iPhone/src/killall.c	2007-12-27 13:28:53.000000000 +0000
@@ -64,9 +64,8 @@
 {
   int res;
   size_t len;
-  char *line;
+  char line[1024];
 
-  line = NULL;
   len = 0;
 
   do {
@@ -79,16 +78,14 @@
 
     fflush (stdout);
 
-    if (getline (&line, &len, stdin) < 0)
+    if (fgets(line, sizeof(line), stdin) == NULL)
       return 0;
     /* Check for default */
     if (line[0] == '\n') {
-      free(line);
       return 0;
     }
     res = rpmatch(line);
     if (res >= 0) {
-      free(line);
       return res;
     }
   } while(1);