#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
+#define ERR_BUFFER_SIZE 1024
static const gchar *_bus_name = NULL;
static GDBusConnection *_gdbus_conn = NULL;
static inline char *_dup_string(const char *string)
{
char *ret;
+ char err_buf[ERR_BUFFER_SIZE];
if (string == NULL)
return NULL;
ret = strdup(string);
if (!ret)
- NOTIFICATION_ERR("Error: %s\n", strerror(errno));
+ NOTIFICATION_ERR("Error: %s\n", strerror_r(errno, err_buf, sizeof(err_buf)));
return ret;
}
}
if (g_dbus_message_to_gerror(*reply, &err)) {
- ret = err->code;
- NOTIFICATION_ERR("_send_sync_noti cmd = %s, error %s", cmd, err->message);
+ if (err->code == G_DBUS_ERROR_ACCESS_DENIED)
+ ret = NOTIFICATION_ERROR_PERMISSION_DENIED;
+ else
+ ret = err->code;
+
+ NOTIFICATION_ERR("_send_sync_noti cmd = %s, error %s, err code %d", cmd, err->message, ret);
g_error_free(err);
return ret;
}
result = NOTIFICATION_ERROR_SERVICE_NOT_READY;
} else if (g_dbus_message_to_gerror(reply, &err)) {
- result = err->code;
- g_error_free(err);
+ if (err->code == G_DBUS_ERROR_ACCESS_DENIED)
+ result = NOTIFICATION_ERROR_PERMISSION_DENIED;
+ else
+ result = err->code;
+
NOTIFICATION_ERR("_send_async_noti error %s", err->message);
+ g_error_free(err);
}
NOTIFICATION_DBG("_send_async_noti done !![%d]", result);
int notification_ipc_request_insert(notification_h noti, int *priv_id)
{
int result;
- int id;
+ int id = NOTIFICATION_PRIV_ID_NONE;
GDBusMessage *reply = NULL;
GVariant *body;
GVariant *reply_body;
if(reply)
g_object_unref(reply);
- NOTIFICATION_DBG("notification_ipc_request_insert done [priv_id : %d, result: %d]", *priv_id, result);
+ NOTIFICATION_DBG("notification_ipc_request_insert done [priv_id : %d, result: %d]", id, result);
return result;
}
int notification_ipc_request_update(notification_h noti)
{
int result;
- int priv_id;
+ int priv_id = NOTIFICATION_PRIV_ID_NONE;
GDBusMessage *reply = NULL;
GVariant *body;
#include <notification_setting_service.h>
#define NOTI_BURST_DELETE_UNIT 10
+#define ERR_BUFFER_SIZE 1024
static void __free_and_set(void **target_ptr, void *new_ptr)
{
char query[NOTIFICATION_QUERY_MAX] = { 0, };
char query_base[NOTIFICATION_QUERY_MAX] = { 0, };
char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
+ char err_buf[ERR_BUFFER_SIZE];
/* Open DB */
db = notification_db_open(DBPATH);
if (tmp) {
*list_deleted_rowid = tmp;
} else {
- NOTIFICATION_ERR("Heap: %s\n", strerror(errno));
+ NOTIFICATION_ERR("Heap: %s\n", strerror_r(errno, err_buf, sizeof(err_buf)));
/*!
* \TODO
* How can I handle this?