From 6921000481d3f8e3e0fecf89df436312efaa691a Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Tue, 15 Sep 2020 22:02:57 +0200 Subject: =?UTF-8?q?Barely=20ever=20seen=20any=201000=20digit=20PIDs=20?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenFilesScreen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenFilesScreen.c') diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c index 3e45bf85..ae32590f 100644 --- a/OpenFilesScreen.c +++ b/OpenFilesScreen.c @@ -52,8 +52,6 @@ void OpenFilesScreen_draw(InfoScreen* this) { } static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) { - char buffer[1025]; - xSnprintf(buffer, 1024, "%d", pid); OpenFiles_ProcessData* pdata = xCalloc(1, sizeof(OpenFiles_ProcessData)); OpenFiles_FileData* fdata = NULL; OpenFiles_Data* item = &(pdata->data); @@ -76,6 +74,8 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) { exit(1); dup2(fdnull, STDERR_FILENO); close(fdnull); + char buffer[32] = {0}; + xSnprintf(buffer, sizeof(buffer), "%d", pid); execlp("lsof", "lsof", "-P", "-p", buffer, "-F", NULL); exit(127); } -- cgit v1.2.3