aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/util.c')
-rw-r--r--common/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/util.c b/common/util.c
index 40c64230..d66058a6 100644
--- a/common/util.c
+++ b/common/util.c
@@ -13,7 +13,6 @@
13#include <xkbcommon/xkbcommon-names.h> 13#include <xkbcommon/xkbcommon-names.h>
14#include <wlr/types/wlr_keyboard.h> 14#include <wlr/types/wlr_keyboard.h>
15#include "log.h" 15#include "log.h"
16#include "readline.h"
17#include "util.h" 16#include "util.h"
18 17
19int wrap(int i, int max) { 18int wrap(int i, int max) {
@@ -87,11 +86,12 @@ pid_t get_parent_pid(pid_t child) {
87 char *token = NULL; 86 char *token = NULL;
88 const char *sep = " "; 87 const char *sep = " ";
89 FILE *stat = NULL; 88 FILE *stat = NULL;
89 size_t buf_size = 0;
90 90
91 sprintf(file_name, "/proc/%d/stat", child); 91 sprintf(file_name, "/proc/%d/stat", child);
92 92
93 if ((stat = fopen(file_name, "r"))) { 93 if ((stat = fopen(file_name, "r"))) {
94 if ((buffer = read_line(stat))) { 94 if (getline(&buffer, &buf_size, stat) != -1) {
95 token = strtok(buffer, sep); // pid 95 token = strtok(buffer, sep); // pid
96 token = strtok(NULL, sep); // executable name 96 token = strtok(NULL, sep); // executable name
97 token = strtok(NULL, sep); // state 97 token = strtok(NULL, sep); // state