diff options
author | CoprDistGit <infra@openeuler.org> | 2024-12-12 02:54:13 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2024-12-12 02:54:13 +0000 |
commit | a35fcc8b3fc340a6b874440b2a87e155c807ece5 (patch) | |
tree | 02ca631dd69c05a4dfcbd98a0ed12e2b0d2cd035 /check-whether-command_prev-is-null-before-assigning-.patch | |
parent | b7abaf7e217d7948f8101d25013189a9322dd6ef (diff) |
automatic import of systemdopeneuler24.03_LTS
Diffstat (limited to 'check-whether-command_prev-is-null-before-assigning-.patch')
-rw-r--r-- | check-whether-command_prev-is-null-before-assigning-.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/check-whether-command_prev-is-null-before-assigning-.patch b/check-whether-command_prev-is-null-before-assigning-.patch new file mode 100644 index 0000000..06ebf86 --- /dev/null +++ b/check-whether-command_prev-is-null-before-assigning-.patch @@ -0,0 +1,35 @@ +From 5fe226b4378a2466d906ae45b8544f1003e9885a Mon Sep 17 00:00:00 2001 +From: yefei25 <yefei25@huawei.com> +Date: Wed, 8 Apr 2020 23:10:58 -0400 +Subject: [PATCH 1/2] check whether command_prev is null before assigning value + +--- + src/core/service.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/core/service.c b/src/core/service.c +index 9a26271f72..3c255b3bcc 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -2569,12 +2569,16 @@ static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, ExecC + assert(s); + assert(id >= 0); + assert(id < _SERVICE_EXEC_COMMAND_MAX); +- ++ if (!current) ++ return 0; + const ExecCommand *first = s->exec_command[id]; + + /* Figure out where we are in the list by walking back to the beginning */ +- for (const ExecCommand *c = current; c != first; c = c->command_prev) ++ for (const ExecCommand *c = current; c != first; c = c->command_prev) { + idx++; ++ if (!c->command_prev) ++ return idx; ++ } + + return idx; + } +-- +2.19.1 + |