diff --git a/src/lib/3rdparty/processinfo.cpp b/src/lib/3rdparty/processinfo.cpp index 1bba34461..cb73df3a5 100644 --- a/src/lib/3rdparty/processinfo.cpp +++ b/src/lib/3rdparty/processinfo.cpp @@ -85,12 +85,12 @@ pid_t ProcessInfo::GetPIDbyName(const char* cchrptr_ProcessName) const if (fd_CmdLineFile) { int r = fscanf(fd_CmdLineFile, "%20s", chrarry_NameOfProcess) ; // read from /proc//cmdline + fclose(fd_CmdLineFile); // close the file prior to exiting the routine + if (r < 1) { continue; } - fclose(fd_CmdLineFile); // close the file prior to exiting the routine - if (strrchr(chrarry_NameOfProcess, '/')) { chrptr_StringToCompare = strrchr(chrarry_NameOfProcess, '/') + 1 ; }