summaryrefslogtreecommitdiffstats
path: root/OpenFilesScreen.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-11-01 01:09:51 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-02 22:15:01 +0100
commit45869513bfebba80cc2ab42e4218f68b34b1e6ac (patch)
treef064631dbff141bf1c945db8cff40b7bb82fd169 /OpenFilesScreen.c
parent61e14d4bb25268593019e6df3eb02264b4ac8e0e (diff)
Embracing branches
Diffstat (limited to 'OpenFilesScreen.c')
-rw-r--r--OpenFilesScreen.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c
index 829fafee..cd309648 100644
--- a/OpenFilesScreen.c
+++ b/OpenFilesScreen.c
@@ -69,10 +69,11 @@ static const char* getDataForType(const OpenFiles_Data* data, char type) {
OpenFilesScreen* OpenFilesScreen_new(const Process* process) {
OpenFilesScreen* this = xMalloc(sizeof(OpenFilesScreen));
Object_setClass(this, Class(OpenFilesScreen));
- if (Process_isThread(process))
+ if (Process_isThread(process)) {
this->pid = process->tgid;
- else
+ } else {
this->pid = process->pid;
+ }
return (OpenFilesScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 3, " FD TYPE MODE DEVICE SIZE NODE NAME");
}
@@ -106,8 +107,10 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) {
dup2(fdpair[1], STDOUT_FILENO);
close(fdpair[1]);
int fdnull = open("/dev/null", O_WRONLY);
- if (fdnull < 0)
+ if (fdnull < 0) {
exit(1);
+ }
+
dup2(fdnull, STDERR_FILENO);
close(fdnull);
char buffer[32] = {0};
@@ -182,10 +185,11 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) {
return pdata;
}
- if (!WIFEXITED(wstatus))
+ if (!WIFEXITED(wstatus)) {
pdata->error = 1;
- else
+ } else {
pdata->error = WEXITSTATUS(wstatus);
+ }
return pdata;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy