Addressing Security Compilation Issues Singed-off-by:dongzhengkuan@huawei.com

Signed-off-by: 15549494042 <dongzhengkuan@huawei.com>
This commit is contained in:
15549494042 2023-11-24 11:34:21 +08:00
parent 36f7f3fbd9
commit e5c9128d56
2 changed files with 12 additions and 2 deletions

View File

@ -126,6 +126,7 @@ private:
static void ReportBlockedReason(JobMonitorParam *param, JobStatus *jobStatus);
static void CopyDirectory(const char *srcDir, const char *destDir);
static void ChangeFilterPermission(const std::string &path, mode_t mode);
static void ReportAbnormalState(PrintServiceAbility *printServiceAbility, std::string serviceJobId);
int32_t StartCupsdService();
void StartNextJob();

View File

@ -507,6 +507,13 @@ int PrintCupsClient::FillJobOptions(JobParameters *jobParams, int num_options, c
return num_options;
}
void PrintCupsClient::ReportAbnormalState(PrintServiceAbility *printServiceAbility, std::string serviceJobId)
{
sleep(INDEX_ONE);
printServiceAbility->UpdatePrintJobState(serviceJobId, PRINT_JOB_BLOCKED,
PRINT_JOB_BLOCKED_NETWORK_ERROR);
}
bool PrintCupsClient::VerifyPrintJob(JobParameters *jobParams, int &num_options, uint32_t &jobId,
cups_option_t *options, http_t *http)
{
@ -516,8 +523,10 @@ bool PrintCupsClient::VerifyPrintJob(JobParameters *jobParams, int &num_options,
}
if (!CheckPrinterOnline(jobParams->printerUri.c_str())) {
PRINT_HILOGE("VerifyPrintJob printer offline");
PrintServiceAbility::GetInstance()->UpdatePrintJobState(jobParams->serviceJobId, PRINT_JOB_BLOCKED,
PRINT_JOB_BLOCKED_NETWORK_ERROR);
// Abnormal status reported too quickly, icon does not display abnormalities
std::thread reportAbnormalThread(ReportAbnormalState, PrintServiceAbility::GetInstance(),
jobParams->serviceJobId);
reportAbnormalThread.detach();
return false;
}
num_options = FillJobOptions(jobParams, num_options, &options);