Merge branch 'main' into home-routed

This commit is contained in:
Sukchan Lee
2025-06-01 16:54:26 +09:00
28 changed files with 1809 additions and 101 deletions

View File

@@ -370,9 +370,17 @@ int ogs_proc_join(ogs_proc_t *const process, int *const out_return_code)
}
if (process->child != waitpid(process->child, &status, 0)) {
process->child = 0;
ogs_error("waitpid failed: %d", status);
return OGS_ERROR;
}
process->child = 0;
if (process->nf_name) {
ogs_free(process->nf_name);
process->nf_name = NULL;
}
if (out_return_code) {
if (WIFEXITED(status)) {
*out_return_code = WEXITSTATUS(status);
@@ -416,9 +424,17 @@ int ogs_proc_terminate(ogs_proc_t *const process)
return OGS_ERROR;
}
#else
if (kill(process->child, SIGTERM) == -1) {
return OGS_ERROR;
if (process->child) {
if (kill(process->child, SIGTERM) == -1) {
if (errno == ESRCH) {
/* No such process */
return OGS_OK;
}
return OGS_ERROR;
}
}
#endif
return OGS_OK;
@@ -434,8 +450,14 @@ int ogs_proc_kill(ogs_proc_t *const process)
return OGS_ERROR;
}
#else
if (kill(process->child, SIGKILL) == -1) {
return OGS_ERROR;
if (process->child) {
if (kill(process->child, SIGKILL) == -1) {
if (errno == ESRCH) {
/* No such process */
return OGS_OK;
}
return OGS_ERROR;
}
}
#endif

View File

@@ -73,6 +73,10 @@ typedef struct ogs_proc_s {
unsigned long dwProcessId;
#else
pid_t child;
// to force kill the right NF in tests if needed.
char *nf_name;
int index;
#endif
} ogs_proc_t;

View File

@@ -754,7 +754,7 @@ static void check_multi_info(ogs_sbi_client_t *client)
}
} else
ogs_warn("[%d] %s", res, conn->error);
ogs_warn("%s (%d): %s", curl_easy_strerror(res), res, conn->error);
ogs_assert(conn->client_cb);
if (res == CURLE_OK)

View File

@@ -45,7 +45,7 @@ cJSON *ogs_sbi_links_convertToJSON(ogs_sbi_links_t *links)
linksJSON = cJSON_CreateObject();
ogs_assert(linksJSON);
cJSON_AddItemToObject(linksJSON, "items", itemsJSON);
cJSON_AddItemToObject(linksJSON, "item", itemsJSON);
cJSON_AddItemToObject(linksJSON, "self", selfJSON);
cJSON_AddNumberToObject(linksJSON, "totalItemCount", cJSON_GetArraySize(itemsJSON));
@@ -73,9 +73,9 @@ ogs_sbi_links_t *ogs_sbi_links_parseFromJSON(cJSON *json)
return NULL;
}
_items = cJSON_GetObjectItemCaseSensitive(_links, "items");
_items = cJSON_GetObjectItemCaseSensitive(_links, "item");
if (!_items) {
ogs_error("No items");
ogs_error("No item");
return NULL;
}