diff options
author | emersion <contact@emersion.fr> | 2019-01-08 10:05:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 10:05:37 +0100 |
commit | 140bc2dd5b81205df58bf06e695788e689fae397 (patch) | |
tree | 6a88913630734736763b12ec0b10da68ef413256 /common/util.c | |
parent | Merge pull request #3337 from RedSoxFan/fix-seat-cmd-cursor (diff) | |
parent | fixup! stringop.c: rewrite strip_whitespace (diff) | |
download | sway-140bc2dd5b81205df58bf06e695788e689fae397.tar.gz sway-140bc2dd5b81205df58bf06e695788e689fae397.tar.zst sway-140bc2dd5b81205df58bf06e695788e689fae397.zip |
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.c | 4 |
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 | ||
19 | int wrap(int i, int max) { | 18 | int 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 |