if it is available.
The data-provider-slave will leave the fault log if it finds a "SO" filename from the siganl handler.
And then if the master catches abnormal termination of slave provider, the master will try to open a
slave's fault log file. if it founds, the master will get the so filename from a log file.
and find the lbid using livebox-service API.
Previously, the master could not find the lbid correctly because of the old style code.
This patch will find the lbid from the DB.
*lbid = livebox Id (aka. dynamic box id)
Change-Id: Idc9ea93bb05c2059d8717385c5610a8ed2f8c22b
Name: data-provider-master
Summary: Master service provider for liveboxes
Name: data-provider-master
Summary: Master service provider for liveboxes
Release: 1
Group: HomeTF/Livebox
License: Flora
Release: 1
Group: HomeTF/Livebox
License: Flora
#include <packet.h>
#include <dlog.h>
#include <livebox-errno.h>
#include <packet.h>
#include <dlog.h>
#include <livebox-errno.h>
+#include <livebox-service.h>
#include "util.h"
#include "debug.h"
#include "util.h"
#include "debug.h"
static char *check_log_file(struct slave_node *slave)
{
static char *check_log_file(struct slave_node *slave)
{
- char pkgname[BUFSIZ];
- const char *pattern = "liblive-";
char filename[BUFSIZ];
snprintf(filename, sizeof(filename), "%s/slave.%d", SLAVE_LOG_PATH, slave_pid(slave));
char filename[BUFSIZ];
snprintf(filename, sizeof(filename), "%s/slave.%d", SLAVE_LOG_PATH, slave_pid(slave));
- ptr = fgets(pkgname, sizeof(pkgname), fp);
+ ptr = fgets(libexec, sizeof(libexec), fp);
if (fclose(fp) != 0) {
ErrPrint("fclose: %s\n", strerror(errno));
}
if (fclose(fp) != 0) {
ErrPrint("fclose: %s\n", strerror(errno));
}
ErrPrint("Invalid log\n");
return NULL;
}
ErrPrint("Invalid log\n");
return NULL;
}
- for (i = 0; pattern[i] && (pattern[i] == pkgname[i]); i++); /*!< Check pattern of filename */
- if (strlen(pattern) != i) {
- ErrPrint("Pattern is not matched: %d\n", i);
- return NULL;
- }
-
- ptr = pkgname + i;
- i = strlen(ptr) - 3; /* Skip the ".so" */
- if (i <= 0 || strcmp(ptr + i, ".so")) {
- ErrPrint("Extension is not matched\n");
- return NULL;
- }
-
- ptr[i] = '\0'; /*!< Truncate tailer ".so" */
if (unlink(filename) < 0) {
ErrPrint("Failed to unlink %s\n", filename);
}
if (unlink(filename) < 0) {
ErrPrint("Failed to unlink %s\n", filename);
}
+ ptr = livebox_service_pkgname_by_libexec(libexec);
+ if (!ptr) {
+ ErrPrint("Failed to find the faulted package\n");
+ }
+
+ DbgPrint("Faulted package: %s\n", ptr);
+ return ptr;
}
HAPI void fault_unicast_info(struct client_node *client, const char *pkgname, const char *filename, const char *func)
}
HAPI void fault_unicast_info(struct client_node *client, const char *pkgname, const char *filename, const char *func)