s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
- namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 20;
+ namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 30;
filename = malloc(namelen);
if (filename) {
- snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, s_info.filename);
+ snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, s_info.filename, getpid());
if (s_info.fp)
fclose(s_info.fp);
{
va_list ap;
int ret;
- struct timeval tv;
if (!s_info.fp)
return LB_STATUS_ERROR_IO;
- if (gettimeofday(&tv, NULL) < 0) {
- ErrPrint("gettimeofday: %s\n", strerror(errno));
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- }
-
- fprintf(s_info.fp, "%d %lu.%lu [%s:%d] ", getpid(), tv.tv_sec, tv.tv_usec, util_basename((char *)func), line);
+ fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
va_start(ap, fmt);
ret = vfprintf(s_info.fp, fmt, ap);
return LB_STATUS_ERROR_MEMORY;
}
- namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 20;
+ namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 30;
filename = malloc(namelen);
if (!filename) {
return LB_STATUS_ERROR_MEMORY;
}
- snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, name);
+ snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, name, getpid());
s_info.fp = fopen(filename, "w+");
if (!s_info.fp) {
static void _handler_delete_single(struct tcb *tcb, struct packet *packet, void *data)
{
+ int num_changes = 0;
int ret = 0, ret_p = 0;
int priv_id = 0;
struct packet *packet_reply = NULL;
if (packet_get(packet, "si", &pkgname, &priv_id) == 2) {
pkgname = get_string(pkgname);
- ret = notification_noti_delete_by_priv_id(pkgname, priv_id);
+ ret = notification_noti_delete_by_priv_id_get_changes(pkgname, priv_id, &num_changes);
- DbgPrint("priv_id: [%d]\n", priv_id);
+ DbgPrint("priv_id: [%d] num_delete:%d\n", priv_id, num_changes);
packet_reply = packet_create_reply(packet, "ii", ret, priv_id);
if (packet_reply) {
if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
ErrPrint("failed to create a reply packet\n");
}
- if (ret != NOTIFICATION_ERROR_NONE) {
- ErrPrint("failed to delete a notification:%d\n", ret);
+ if (ret != NOTIFICATION_ERROR_NONE && num_changes <= 0) {
+ ErrPrint("failed to delete a notification:%d %d\n", ret, num_changes);
return ;
}