From 39629abca99c72b2dee04aa359ea09bb1648ff31 Mon Sep 17 00:00:00 2001 From: Zihao Xue Date: Tue, 18 Jun 2024 14:36:30 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E6=97=A0=E7=BB=93=E6=9E=9C=E5=90=8E=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E6=97=A0=E7=8A=B6=E6=80=81=E7=A0=81=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/inc/pwrerr.h | 1 + pwrapis/src/procservice.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/common/inc/pwrerr.h b/common/inc/pwrerr.h index 3550d74..8c41de0 100644 --- a/common/inc/pwrerr.h +++ b/common/inc/pwrerr.h @@ -56,6 +56,7 @@ enum PWR_RtnCode { PWR_ERR_CONTROL_AUTH_OWNERED_BY_OTHERS, PWR_ERR_CONTROL_AUTH_NO_PERMISSION = 405, PWR_ERR_NOT_SUPPORT_TASK_TYPE, + PWR_ERR_NO_PROCS_BY_KEYWORD, PWR_ERR_FILE_ACCESS_FAILED = 500, PWR_ERR_FILE_FPRINT_FAILED, PWR_ERR_FILE_FFLUSH_FAILED, diff --git a/pwrapis/src/procservice.c b/pwrapis/src/procservice.c index 1f8a7c7..d627559 100644 --- a/pwrapis/src/procservice.c +++ b/pwrapis/src/procservice.c @@ -181,6 +181,9 @@ static int QueryProcs(const char *keyWords, pid_t procs[], int maxNum, int *proc (*procNum)++; } pclose(fp); + if (*procNum == 0) { + return PWR_ERR_NO_PROCS_BY_KEYWORD; + } return PWR_SUCCESS; } -- Gitee