diff options
author | Benny Baumann <BenBE@geshi.org> | 2021-05-25 19:02:12 +0200 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2021-05-25 21:55:04 +0200 |
commit | b6ff5c8a2e5981a0e71423953b565a1389c5428d (patch) | |
tree | 5091521cb893526ab1e35db19768254d08e35700 /linux/LinuxProcess.c | |
parent | c408add10847c597de9fb7ba76295c386dc39649 (diff) |
Move CWD field handling to platform-neutral code
Diffstat (limited to 'linux/LinuxProcess.c')
-rw-r--r-- | linux/LinuxProcess.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index d90c8d1e..bd7a7300 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -99,7 +99,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [SECATTR] = { .name = "SECATTR", .title = " Security Attribute ", .description = "Security attribute of the process (e.g. SELinux or AppArmor)", .flags = PROCESS_FLAG_LINUX_SECATTR, }, [PROC_COMM] = { .name = "COMM", .title = "COMM ", .description = "comm string of the process from /proc/[pid]/comm", .flags = 0, }, [PROC_EXE] = { .name = "EXE", .title = "EXE ", .description = "Basename of exe of the process from /proc/[pid]/exe", .flags = 0, }, - [CWD] = { .name ="CWD", .title = "CWD ", .description = "The current working directory of the process", .flags = PROCESS_FLAG_LINUX_CWD, }, + [CWD] = { .name = "CWD", .title = "CWD ", .description = "The current working directory of the process", .flags = PROCESS_FLAG_CWD, }, }; Process* LinuxProcess_new(const Settings* settings) { @@ -116,7 +116,6 @@ void Process_delete(Object* cast) { #ifdef HAVE_OPENVZ free(this->ctid); #endif - free(this->cwd); free(this->secattr); free(this); } @@ -259,20 +258,6 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces xSnprintf(buffer, n, "%5lu ", lp->ctxt_diff); break; case SECATTR: snprintf(buffer, n, "%-30s ", lp->secattr ? lp->secattr : "?"); break; - case CWD: { - const char* cwd; - if (!lp->cwd) { - attr = CRT_colors[PROCESS_SHADOW]; - cwd = "N/A"; - } else if (String_startsWith(lp->cwd, "/proc/") && strstr(lp->cwd, " (deleted)") != NULL) { - attr = CRT_colors[PROCESS_SHADOW]; - cwd = "main thread terminated"; - } else { - cwd = lp->cwd; - } - Process_printLeftAlignedField(str, attr, cwd, 25); - return; - } default: Process_writeField(this, str, field); return; @@ -364,8 +349,6 @@ static int LinuxProcess_compareByKey(const Process* v1, const Process* v2, Proce return SPACESHIP_NUMBER(p1->ctxt_diff, p2->ctxt_diff); case SECATTR: return SPACESHIP_NULLSTR(p1->secattr, p2->secattr); - case CWD: - return SPACESHIP_NULLSTR(p1->cwd, p2->cwd); default: return Process_compareByKey_Base(v1, v2, key); } |