aboutsummaryrefslogtreecommitdiff
path: root/common/util.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-01-08 10:05:37 +0100
committerGitHub <noreply@github.com>2019-01-08 10:05:37 +0100
commit140bc2dd5b81205df58bf06e695788e689fae397 (patch)
tree6a88913630734736763b12ec0b10da68ef413256 /common/util.c
parent353d9ed74f3560e12500c08920cf8a1ca3344cc2 (diff)
parent5bef06adfdac4ce9940dcaf2d90a4bdffae7bba9 (diff)
Merge pull request #3275 from ianyfan/remove-readline
Rewrite strip_whitespace and remove readline.c
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 @@
#include <xkbcommon/xkbcommon-names.h>
#include <wlr/types/wlr_keyboard.h>
#include "log.h"
-#include "readline.h"
#include "util.h"
int wrap(int i, int max) {
@@ -87,11 +86,12 @@ pid_t get_parent_pid(pid_t child) {
char *token = NULL;
const char *sep = " ";
FILE *stat = NULL;
+ size_t buf_size = 0;
sprintf(file_name, "/proc/%d/stat", child);
if ((stat = fopen(file_name, "r"))) {
- if ((buffer = read_line(stat))) {
+ if (getline(&buffer, &buf_size, stat) != -1) {
token = strtok(buffer, sep); // pid
token = strtok(NULL, sep); // executable name
token = strtok(NULL, sep); // state