From a987d5951a1eab5a471c30daea3c94a2d31895f6 Mon Sep 17 00:00:00 2001 From: SuvarnaMeenakshi <50386592+SuvarnaMeenakshi@users.noreply.github.com> Date: Tue, 11 Aug 2020 13:58:20 -0700 Subject: [PATCH] [systemd-generator]: Remove creation of NUM_ASIC environment (#5122) NUM_ASIC environment variable was added so that it could be used by other utilities. This is not being used by any other utility or docker, hence removing the addition of NUM_ASIC environment variable. Also, the environment variable was added by adding the variable value to /etc/environ file. Upon each reboot, this file gets updated with the NUM_ASIC value but the existing value was not removed. This causes multiple lines getting appended in /etc/environ file upon each reboot. Signed-off-by: SuvarnaMeenakshi --- src/systemd-sonic-generator/systemd-sonic-generator.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/systemd-sonic-generator/systemd-sonic-generator.c b/src/systemd-sonic-generator/systemd-sonic-generator.c index e801fcb229d2..1052e2db622a 100644 --- a/src/systemd-sonic-generator/systemd-sonic-generator.c +++ b/src/systemd-sonic-generator/systemd-sonic-generator.c @@ -498,7 +498,6 @@ static int get_num_of_asic() { Determines if the current platform is single or multi-ASIC ***/ FILE *fp; - FILE *env_fp; char *line = NULL; char* token; char* platform; @@ -546,15 +545,6 @@ static int get_num_of_asic() { free(line); } } - - /*set environment variable NUM_ASIC */ - env_fp = fopen("/etc/environment", "a"); - if (env_fp == NULL) { - fprintf(stderr, "Failed to open environment file\n"); - exit(EXIT_FAILURE); - } - fprintf(env_fp, "NUM_ASIC=%d\n", num_asic); - fclose(env_fp); return num_asic; }