Match-id-6b1150d20beff1efde2654461ec07a0afa9e8a88

This commit is contained in:
BianTanggui
2022-06-22 14:21:28 +08:00
parent ab4fa9e56f
commit e19736dbaf

View File

@@ -76,7 +76,6 @@ static bool PidCmdArgParser(struct CmdArgs *args, const char *arg)
Logger("args, arg pointer is null!", LEVEL_ERROR, SCREEN_YES);
return false;
}
errno = 0;
args->pid = strtol(optarg, NULL, DECIMAL);
const char* pidMax = "/proc/sys/kernel/pid_max";
const size_t maxFileSzieMb = 10; // max 10MB
@@ -84,6 +83,7 @@ static bool PidCmdArgParser(struct CmdArgs *args, const char *arg)
Logger("failed to check pid_max path.", LEVEL_ERROR, SCREEN_YES);
return false;
}
errno = 0;
FILE* pFile = NULL;
pFile = fopen(pidMax, "r");
if ((pFile == NULL) || (fgets(buff, PATH_MAX, pFile) == NULL)) {