From b87ff824659ed1c071b150ce80ef532581c89ad7 Mon Sep 17 00:00:00 2001 From: sun_fan Date: Mon, 9 Aug 2021 17:27:29 +0800 Subject: [PATCH] init: fix code style Signed-off-by: sun_fan --- services/src/init_cmds.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/services/src/init_cmds.c b/services/src/init_cmds.c index 23d66218..6301e3e8 100644 --- a/services/src/init_cmds.c +++ b/services/src/init_cmds.c @@ -242,12 +242,11 @@ static void DoSetDomainname(const char *cmdContent, int maxArg) INIT_LOGE("DoSetHostname failed to write %s to \"/proc/sys/kernel/domainname\". err = %d", errno); } - if (fd > 0) { - close(fd); - fd = -1; - } + close(fd); + fd = -1; out: FreeCmd(&ctx); + fd = -1; return; } @@ -267,12 +266,11 @@ static void DoSetHostname(const char *cmdContent, int maxArg) INIT_LOGE("DoSetHostname failed to write %s to \"/proc/sys/kernel/hostname\". err = %d", errno); } - if (fd > 0) { - close(fd); - fd = -1; - } + close(fd); + fd = -1; out: FreeCmd(&ctx); + fd = -1; return; } -- GitLab