src/main.c:68:3: error: 'strncpy' output truncated before terminating nul
copying 7 bytes from a string of the same length [-Werror=stringop-truncation]
68 | strncpy(process_name, "Unknown", strlen("Unknown"));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/orchestration_client.c:38:22: warning: implicit declaration of function
'getpid' [-Wimplicit-function-declaration]
38 | int client_pid = getpid();
| ^~~~~~
if (get_process_name_by_pid(process_name, client_pid) != 0) {
DEBUG("could not get Process name");
- strncpy(process_name, "Unknown", strlen("Unknown"));
+ strncpy(process_name, "Unknown", sizeof(process_name) - 1);
}
DEBUG("[orchestration_server]\n")
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <dbus_consumer.h>
/* ---------------------------------------------------------------------------------------------------- */