1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Merge pull request #1702 from philippwiesemann/fix-lib-proc-file-closes

Fix not closing cmdline files from /proc/ on read errors (in master branch)
This commit is contained in:
David Rosca 2015-09-11 22:08:11 +02:00
commit a21c9a2ab4

View File

@ -85,12 +85,12 @@ pid_t ProcessInfo::GetPIDbyName(const char* cchrptr_ProcessName) const
if (fd_CmdLineFile) { if (fd_CmdLineFile) {
int r = fscanf(fd_CmdLineFile, "%20s", chrarry_NameOfProcess) ; // read from /proc/<NR>/cmdline int r = fscanf(fd_CmdLineFile, "%20s", chrarry_NameOfProcess) ; // read from /proc/<NR>/cmdline
fclose(fd_CmdLineFile); // close the file prior to exiting the routine
if (r < 1) { if (r < 1) {
continue; continue;
} }
fclose(fd_CmdLineFile); // close the file prior to exiting the routine
if (strrchr(chrarry_NameOfProcess, '/')) { if (strrchr(chrarry_NameOfProcess, '/')) {
chrptr_StringToCompare = strrchr(chrarry_NameOfProcess, '/') + 1 ; chrptr_StringToCompare = strrchr(chrarry_NameOfProcess, '/') + 1 ;
} }