Fix a SVACE reported bug 35/277635/1 accepted/tizen/unified/20220712.010808 submit/tizen/20220711.085003 submit/tizen/20220711.085050
authorUnsung Lee <unsung.lee@samsung.com>
Mon, 11 Jul 2022 08:40:29 +0000 (17:40 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Mon, 11 Jul 2022 08:40:29 +0000 (17:40 +0900)
Change-Id: I2056c0a36ba89214c13b6b864b6ed496cfe028d6
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/plugin/plugin.c

index 67f19e0bf8d4a02ea9c70c07ebe7e35010ceeaac..038886edc6fa0da11586c4f676f1ea753cff005d 100644 (file)
@@ -112,7 +112,10 @@ static int resource_cpu_boosting_send_command (cpu_boosting_input_t input, int s
 
        byte = send(sock, (const void *)&input, sizeof(input), 0);
        if (byte != sizeof(input)) {
-               _E("[CPU-BOOSTING-PLUGIN] error is based on %s", strerror(errno));
+               char error_buf[1024];
+               strerror_r(errno, error_buf, sizeof(error_buf));
+
+               _E("[CPU-BOOSTING-PLUGIN] error is based on %s", error_buf);
                _E("[CPU-BOOSTING-PLUGIN] client input size is %u, but sent size is %d",
                                (unsigned int)sizeof(input), byte);
                return -1;
@@ -121,7 +124,10 @@ static int resource_cpu_boosting_send_command (cpu_boosting_input_t input, int s
        if (input.body_size > 0) {
                byte = send(sock, (const void *)input.pid.tid, input.body_size, 0);
                if (byte != input.body_size) {
-                       _E("[CPU-BOOSTING-PLUGIN] error is based on %s", strerror(errno));
+                       char error_buf[1024];
+                       strerror_r(errno, error_buf, sizeof(error_buf));
+
+                       _E("[CPU-BOOSTING-PLUGIN] error is based on %s", error_buf);
                        _E("[CPU-BOOSTING-PLUGIN] client input size is %d, but sent size is %d",
                                        input.body_size, byte);
                        return -1;
@@ -205,7 +211,10 @@ API int resource_get_cpu_boosting_level (resource_pid_t pid,
 
        byte = recv(sock, (void *)&output, sizeof(output), 0);
        if (byte != sizeof(output)) {
-               _E("[CPU-BOOSTING-PLUGIN] error is based on %s", strerror(errno));
+               char error_buf[1024];
+               strerror_r(errno, error_buf, sizeof(error_buf));
+
+               _E("[CPU-BOOSTING-PLUGIN] error is based on %s", error_buf);
                _E("[CPU-BOOSTING-PLUGIN] client output size is %u, but received size is %d",
                                (unsigned int)sizeof(output), byte);
                ret = -1;
@@ -224,7 +233,10 @@ API int resource_get_cpu_boosting_level (resource_pid_t pid,
 
                byte = recv(sock, (void *)level->tid_level, level->tid_count * sizeof(int), 0);
                if (byte != level->tid_count * sizeof(int)) {
-                       _E("[CPU-BOOSTING-PLUGIN] error is based on %s", strerror(errno));
+                       char error_buf[1024];
+                       strerror_r(errno, error_buf, sizeof(error_buf));
+
+                       _E("[CPU-BOOSTING-PLUGIN] error is based on %s", error_buf);
                        _E("[CPU-BOOSTING-PLUGIN] client output size is %u, but received size is %d",
                                        level->tid_count * (unsigned int)sizeof(int), byte);
                        free(level->tid_level);